Fix to use spf13/pflag instead of flag - #94
Open
5ouma wants to merge 2 commits into
Open
Conversation
The official flag package doesn't match the project's flag detection.
Verify only flags that passed are recognized.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a CLI flag detection bug by ensuring the utility helper uses github.com/spf13/pflag (matching the rest of the app) rather than Go’s stdlib flag, resolving the mismatch described in issue #93.
Changes:
- Switch
internal/util.IsFlagPassedfrom stdlibflagtospf13/pflag. - Update
IsFlagPassedtests to usepflagand to explicitly set upflag.CommandLineper subtest.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| internal/util/isFlagPassed.go | Aligns flag inspection with spf13/pflag used by the CLI, fixing missed-flag detection. |
| internal/util/isFlagPassed_test.go | Reworks tests to use pflag and validate both passed and non-passed cases by configuring a test flagset. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The official flag package were used in a util package accidentally on refactoring.
fix: #93