Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic: flag redefined #1560

Closed
3 tasks done
hagen1778 opened this issue Nov 1, 2022 · 3 comments · Fixed by #1561
Closed
3 tasks done

panic: flag redefined #1560

hagen1778 opened this issue Nov 1, 2022 · 3 comments · Fixed by #1561
Labels
area/v2 relates to / is being considered for v2 kind/bug describes or fixes a bug status/triage maintainers still need to look into this

Comments

@hagen1778
Copy link

My urfave/cli version is

v2.23.0

Checklist

  • Are you running the latest v2 release? The list of releases is here.
  • Did you check the manual for your release? The v2 manual is here
  • Did you perform a search about this problem? Here's the GitHub guide about searching.

Dependency Management

  • My project is using go modules.
  • My project is using vendoring.

Describe the bug

With ae8d932 urfave/cli/v2 starts to conflict with other dependencies which has the same flags. In my case, it is version flag exposed by both urfave/cli/v2 and one of my other dependencies. This broke a build once I get updated the library.

To reproduce

Create an app that has a defined version flag or imports any dependency which has the same flag. Then use urfave/cli/v2@2.23.0 and try to run the app.

Observed behavior

myapp flag redefined: version
panic: myapp flag redefined: version

Expected behavior

Do not interfere with other dependencies flags.

@hagen1778 hagen1778 added area/v2 relates to / is being considered for v2 kind/bug describes or fixes a bug status/triage maintainers still need to look into this labels Nov 1, 2022
@dearchap
Copy link
Contributor

dearchap commented Nov 1, 2022

@hagen1778 Can you set App.HideVersion to true so that the cli library doesnt append version flag ?

@hagen1778
Copy link
Author

Thanks for quick response @dearchap! App.HideVersion helped.

@johejo
Copy link

johejo commented Nov 2, 2022

For example, it confuses many users to panic just by importing github.com/golang/glog.

https://go.dev/play/p/WAxoXS_BHib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/v2 relates to / is being considered for v2 kind/bug describes or fixes a bug status/triage maintainers still need to look into this
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants