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

v1 bug: ( Cannot use cli.StringFlag (type cli.StringFlag) as type cli.Flag ) #1010

Closed
ImJerryChan opened this issue Dec 24, 2019 · 1 comment
Assignees
Labels
area/v1 relates to / is being considered for v1 kind/bug describes or fixes a bug status/triage maintainers still need to look into this

Comments

@ImJerryChan
Copy link

ImJerryChan commented Dec 24, 2019

Hello, it's my first time to use this module. I have a question about manual v1.
https://github.com/urfave/cli/blob/master/docs/v1/manual.md#placeholder-values
I see the manual tell us to change type cli.StringFlag as cli.Flag(An interface type), but when I compile the code below, it will raise an error

app.Flags = []cli.Flag{
    cli.StringFlag{  // raise an error "Cannot use cli.StringFlag (type cli.StringFlag) as type cli.Flag"
      Name:  "config, c",
      Usage: "Load configuration from `FILE`",
    },
    &cli.StringFlag{  // OK
      Name:  "config, c",
      Usage: "Load configuration from `FILE`",
    },
  }

When I finish compiling with my solution, I haven't seen the result in help output like:--config FILE, -c FILE Load configuration from FILE,does the document need to be updated?

I use go get -t -v github.com/urfave/cli to download this module, and my go version is go1.13.4 linux/amd64

Can you point out my mistake?
thank you.

@ImJerryChan ImJerryChan added status/triage maintainers still need to look into this kind/bug describes or fixes a bug area/v1 relates to / is being considered for v1 labels Dec 24, 2019
@ImJerryChan ImJerryChan changed the title v1 bug: ( Cannot use cli.IntFlag (type cli.IntFlag) as type cli.Flag ) v1 bug: ( Cannot use cli.StringFlag (type cli.StringFlag) as type cli.Flag ) Dec 24, 2019
@coilysiren
Copy link
Member

@ImJerryChan

The issue you are having is caused by using the v1 manual with v2 of the library. Please do either of the following things:

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

No branches or pull requests

2 participants