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

Conflict between global flags set by godog.BindCommandLineFlags and spf13/cobra #593

Open
isy opened this issue Dec 19, 2023 · 1 comment

Comments

@isy
Copy link

isy commented Dec 19, 2023

👓 What did you see?

While testing my program which implemented a command with spf13/cobra, I received an error message that says "unable to redefine 'c' shorthand in "xxxxxxxxxx" flagset: it's already used for "xxxxxxxxxxxxx" flag".

The shorthand c in the global flags set by godog.BindCommandLineFlags was causing a collision with a shorthand c in my cobra command.

✅ What did you expect to see?

I expected the godog package to be compatible with my cobra command without any conflicts.

📦 Which tool/library version are you using?

v0.13.0

🔬 How could we reproduce it?

Steps to reproduce the behavior:

1.Install both godog and cobra
2.Create a Cobra command with a shorthand 'c'
3.Use godog.BindCommandLineFlags to bind global flags
4.Run the test command
5.You should see the error unable to redefine 'c' shorthand in "xxxxxxxxx" flagset: it's already used for "xxxxxxxxx" flag

📚 Any additional context?

Given that this collision is possible, it suggests that there may be an issue with godog's global flag setting feature that needs to be addressed. I wonder if there's a measure we can take on the godog side, such as not assigning shorthands to the global flags set by godog.BindCommandLineFlags.

I look forward to your thoughts and response. Thank you.


This text was originally generated from a template, then edited by hand. You can modify the template here.

@vearutop
Copy link
Member

vearutop commented May 2, 2024

Please use godog.BindFlags, probably we should tag godog.BindCommandLineFlags as deprecated and remove it in the future.

Also, could you explain the situation/use case in which you needed to call godog.BindCommandLineFlags?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants