Skip to content

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

Open
@isy

Description

@isy

👓 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions