-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Description
When trying to follow "My First CLI" guide:
mkdir my-clicd my-cli/go mod init my-cli
go: creating new go.mod: module my-cligo get -u github.com/spf13/cobra@latest
go: added github.com/inconshreveable/mousetrap v1.1.0
go: added github.com/spf13/cobra v1.9.1
go: added github.com/spf13/pflag v1.0.8go install github.com/spf13/cobra-cli@latestcobra-cli init
Your Cobra application is ready at
/Users/keyvhinng/Developer/learning/cli/my-clicobra-cli add serve
serve created at /Users/keyvhinng/Developer/learning/cli/my-clgo build -o my-cli
# github.com/spf13/cobra
../../../../go/pkg/mod/github.com/spf13/[email protected]/command.go:42:30: undefined: flag.ParseErrorsWhitelist
../../../../go/pkg/mod/github.com/spf13/[email protected]/command.go:1875:12: c.Flags().ParseErrorsWhitelist undefined (type *pflag.FlagSet has no field or method ParseErrorsWhitelist)
../../../../go/pkg/mod/github.com/spf13/[email protected]/command.go:1875:40: undefined: flag.ParseErrorsWhitelistThis is the response from Gemini:
It looks like you've run into a version incompatibility issue between the cobra library and the version of Go you're using. The
error undefined: flag.ParseErrorsWhitelist happens because that feature was removed from Go's flag package in Go 1.20, and older
versions of pflag (a dependency of Cobra) still try to use it.
Is cobra fully supported on Go 1.25 ?
WeiChieh-Chen
Metadata
Metadata
Assignees
Labels
No labels