You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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?
What's the status on this? Currently godog.BindFlags is marked as deprecated in favour of godog.BindCommandLineFlags. I'm currently still using godog.BindFlags, but tried to switch over to BindCommandLineFlags, which requires me to use pflags. I'm reluctant to do so given that this issue is more recent, and seems to indicate that we should really favour using godog.BindFlags
👓 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.
The text was updated successfully, but these errors were encountered: