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

Panic when executing cli kubectl-kudo package params list --help #1120

Closed
sharego opened this issue Nov 30, 2019 · 2 comments · Fixed by #1121
Closed

Panic when executing cli kubectl-kudo package params list --help #1120

sharego opened this issue Nov 30, 2019 · 2 comments · Fixed by #1121
Labels

Comments

@sharego
Copy link
Contributor

sharego commented Nov 30, 2019

What happened:
Panic when run kubectl-kudo package params list --help
Output:

panic: unable to redefine 'v' shorthand in "list" flagset: it's already used for "version" flag

goroutine 1 [running]:
github.com/spf13/pflag.(*FlagSet).AddFlag(0xc00041d500, 0xc00064c280)
	/Users/kensipe/projects/go/pkg/mod/github.com/spf13/pflag@v1.0.5/flag.go:874 +0x6d7
github.com/spf13/pflag.(*FlagSet).AddFlagSet.func1(0xc00064c280)
	/Users/kensipe/projects/go/pkg/mod/github.com/spf13/pflag@v1.0.5/flag.go:887 +0xa8
github.com/spf13/pflag.(*FlagSet).VisitAll(0xc000166600, 0xc0005e7b28)
	/Users/kensipe/projects/go/pkg/mod/github.com/spf13/pflag@v1.0.5/flag.go:290 +0x94
github.com/spf13/pflag.(*FlagSet).AddFlagSet(0xc00041d500, 0xc000166600)
	/Users/kensipe/projects/go/pkg/mod/github.com/spf13/pflag@v1.0.5/flag.go:885 +0x58
github.com/spf13/cobra.(*Command).mergePersistentFlags(0xc000648000)
	/Users/kensipe/projects/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:1572 +0x90
github.com/spf13/cobra.stripFlags(0xc000289650, 0x1, 0x1, 0xc000648000, 0x1, 0x0, 0x1)
	/Users/kensipe/projects/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:538 +0x51
github.com/spf13/cobra.(*Command).Find.func1(0xc000648000, 0xc000289650, 0x1, 0x1, 0x4, 0xc000289650, 0x1, 0x1)
	/Users/kensipe/projects/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:597 +0x5c
github.com/spf13/cobra.(*Command).Find.func1(0xc000643b80, 0xc000525d00, 0x2, 0x2, 0x6, 0xc000525d00, 0x2, 0x2)
	/Users/kensipe/projects/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:605 +0x119
github.com/spf13/cobra.(*Command).Find.func1(0xc000643680, 0xc000343f20, 0x3, 0x3, 0x7, 0xc000343f20, 0x3, 0x3)
	/Users/kensipe/projects/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:605 +0x119
github.com/spf13/cobra.(*Command).Find.func1(0xc000642780, 0xc0000c0010, 0x4, 0x4, 0x1, 0x1, 0xc, 0x1a31136)
	/Users/kensipe/projects/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:605 +0x119
github.com/spf13/cobra.(*Command).Find(0xc000642780, 0xc0000c0010, 0x4, 0x4, 0x14, 0x19ff670, 0x8, 0x19f7bcb, 0x2, 0xc000414804)
	/Users/kensipe/projects/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:610 +0x8c
github.com/spf13/cobra.(*Command).ExecuteC(0xc000642780, 0x0, 0x1742aa0, 0xc0000a0058)
	/Users/kensipe/projects/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:895 +0x60c
github.com/spf13/cobra.(*Command).Execute(...)
	/Users/kensipe/projects/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:864
main.main()
	/Users/kensipe/projects/go/src/github.com/kudobuilder/kudo/cmd/kubectl-kudo/main.go:24 +0x27

What you expected to happen:
cli execute with no error, print List operator parameters

How to reproduce it (as minimally and precisely as possible):
Execute: kubectl-kudo package params list --help

Anything else we need to know?:

The reason is -v is a global flag for log level, see below:

Global Flags:
      --home string           location of your KUDO config. (default "/home/xw/.kudo")
      --kubeconfig string     Path to your Kubernetes configuration file. (default "/home/xw/.kube/config")
  -n, --namespace string      Target namespace for the object. (default "default")
      --request-timeout int   Request timeout value, in seconds.  Defaults to 0 (unlimited)
  -v, --v                     log level for V logs

Environment:

  • Kubernetes version (use kubectl version):
    Client Version: v1.16.2
    Server Version: v1.15.5
  • Kudo version (use kubectl kudo version):
    KUDO Version: version.Info{GitVersion:"0.8.0", GitCommit:"2a585aed", BuildDate:"2019-11-08T16:35:17Z", GoVersion:"go1.13.4", Compiler:"gc", Platform:"linux/amd64"}
  • Operator:
  • operatorVersion:
  • Cloud provider or hardware configuration:
  • OS (e.g. from /etc/os-release):
  • Kernel (e.g. uname -a):
  • Install tools:
  • Others:
@sharego
Copy link
Contributor Author

sharego commented Nov 30, 2019

Suggest just remove the short flag -v, keep the long flag --version for setting the specific package version, I send a PR for this.
Welcome opinions, if it is not ok.

@alenkacz
Copy link
Contributor

@sharego oops sorry! :((( I did not see your comment. I closed my PR, feel free to submit yours :) your solution is valid...

zen-dog pushed a commit that referenced this issue Dec 2, 2019
Remove cli package params list version shorthand flag `-v`

Fix:  #1120
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants