Page MenuHomePhabricator

mwcli docs generation fails
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

  • Pull latest code for mwcli
  • make docs in the mwcli repo

What happens?:

$ make docs
go generate gitlab.wikimedia.org/repos/releng/cli
Building  to ./bin
go build -v -ldflags "-X main.BuildDate=2022-03-28T22:14:52Z -X main.GitCommit=eeb1dcf -X main.GitBranch=main -X main.GitState=clean -X main.GitSummary=v0.12.0 -X main.Version=latest" -o bin/mw ./
rm -rf ./_docs/*
go run ./tools/docs-gen/main.go
panic: unable to redefine 'v' shorthand in "clone" flagset: it's already used for "visibility" flag

goroutine 1 [running]:
github.com/spf13/pflag.(*FlagSet).AddFlag(0xc00027d600, 0xc000524f00)
	/Users/jhuneidi/go/pkg/mod/github.com/spf13/pflag@v1.0.5/flag.go:874 +0x3f5
github.com/spf13/pflag.(*FlagSet).AddFlagSet.func1(0xc000524f00)
	/Users/jhuneidi/go/pkg/mod/github.com/spf13/pflag@v1.0.5/flag.go:887 +0x65
github.com/spf13/pflag.(*FlagSet).VisitAll(0x5, 0xc0005579a8)
	/Users/jhuneidi/go/pkg/mod/github.com/spf13/pflag@v1.0.5/flag.go:290 +0xe3
github.com/spf13/pflag.(*FlagSet).AddFlagSet(0xc0002f7900, 0x0)
	/Users/jhuneidi/go/pkg/mod/github.com/spf13/pflag@v1.0.5/flag.go:885 +0x3d
github.com/spf13/cobra.(*Command).mergePersistentFlags(0xc0002f7900)
	/Users/jhuneidi/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:1658 +0x65
github.com/spf13/cobra.(*Command).InitDefaultHelpFlag(0x0)
	/Users/jhuneidi/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:1032 +0x25
github.com/spf13/cobra/doc.GenMarkdownCustom(0xc0002f7900, {0x1f5b100, 0xc000468f68}, 0x1df6498)
	/Users/jhuneidi/go/pkg/mod/github.com/spf13/cobra@v1.3.0/doc/md_docs.go:56 +0x5b
github.com/spf13/cobra/doc.GenMarkdownTreeCustom(0xc0002f7900, {0x1ce0798, 0x7}, 0x1df6490, 0x1ccf372)
	/Users/jhuneidi/go/pkg/mod/github.com/spf13/cobra@v1.3.0/doc/md_docs.go:151 +0x307
github.com/spf13/cobra/doc.GenMarkdownTreeCustom(0xc0002f7400, {0x1ce0798, 0x7}, 0x1df6490, 0x1ccf372)
	/Users/jhuneidi/go/pkg/mod/github.com/spf13/cobra@v1.3.0/doc/md_docs.go:135 +0x185
github.com/spf13/cobra/doc.GenMarkdownTreeCustom(0xc000157b80, {0x1ce0798, 0x7}, 0x1df6490, 0xc0003b6a00)
	/Users/jhuneidi/go/pkg/mod/github.com/spf13/cobra@v1.3.0/doc/md_docs.go:135 +0x185
github.com/spf13/cobra/doc.GenMarkdownTreeCustom(0xc000614780, {0x1ce0798, 0x7}, 0x1df6490, 0x0)
	/Users/jhuneidi/go/pkg/mod/github.com/spf13/cobra@v1.3.0/doc/md_docs.go:135 +0x185
main.main()
	/Users/jhuneidi/projects/cli/tools/docs-gen/main.go:35 +0x71
exit status 2
make: *** [docs] Error 1

What should have happened instead?:
Docs should generate without error

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc.:
mw version latest ( 2022-03-28T22:14:52Z )
https://gitlab.wikimedia.org/repos/releng/cli/-/releases

pandoc 2.17.1.1
Compiled with pandoc-types 1.22.1, texmath 0.12.4, skylighting 0.12.2,
citeproc 0.6.0.1, ipynb 0.2

Details

ReferenceSource BranchDest BranchAuthorTitle
repos/releng/cli!177fix-docs-gen-and-flagsmainaddshoreFix doc gen and flags
Customize query in GitLab

Event Timeline

jeena renamed this task from mwcli docs generaiton fails to mwcli docs generation fails.Mar 29 2022, 8:11 AM
jeena created this task.
Addshore moved this task from Inbox to In Progress on the mwcli board.

This also happens with gitlab repo clone

~/go/src/gitlab.wikimedia.org/repos/releng/cli (main) $ ./bin/mw gitlab repo clone
panic: unable to redefine 'v' shorthand in "clone" flagset: it's already used for "visibility" flag

goroutine 1 [running]:
github.com/spf13/pflag.(*FlagSet).AddFlag(0xc000147600, 0xc00036c500)
        /home/adam/go/src/gitlab.wikimedia.org/repos/releng/cli/vendor/github.com/spf13/pflag/flag.go:874 +0x3f5
github.com/spf13/pflag.(*FlagSet).AddFlagSet.func1(0xc00036c500)
        /home/adam/go/src/gitlab.wikimedia.org/repos/releng/cli/vendor/github.com/spf13/pflag/flag.go:887 +0x65
github.com/spf13/pflag.(*FlagSet).VisitAll(0x5, 0xc00098fac8)
        /home/adam/go/src/gitlab.wikimedia.org/repos/releng/cli/vendor/github.com/spf13/pflag/flag.go:290 +0xe3
github.com/spf13/pflag.(*FlagSet).AddFlagSet(0xc0001dd180, 0x5)
        /home/adam/go/src/gitlab.wikimedia.org/repos/releng/cli/vendor/github.com/spf13/pflag/flag.go:885 +0x3d
github.com/spf13/cobra.(*Command).mergePersistentFlags(0xc0001dd180)
        /home/adam/go/src/gitlab.wikimedia.org/repos/releng/cli/vendor/github.com/spf13/cobra/command.go:1658 +0x65
github.com/spf13/cobra.(*Command).InitDefaultHelpFlag(0xc000134380)
        /home/adam/go/src/gitlab.wikimedia.org/repos/releng/cli/vendor/github.com/spf13/cobra/command.go:1032 +0x25
github.com/spf13/cobra.(*Command).execute(0xc0001dd180, {0x1af8348, 0x0, 0x0})
        /home/adam/go/src/gitlab.wikimedia.org/repos/releng/cli/vendor/github.com/spf13/cobra/command.go:780 +0x107
github.com/spf13/cobra.(*Command).ExecuteC(0xc000617680)
        /home/adam/go/src/gitlab.wikimedia.org/repos/releng/cli/vendor/github.com/spf13/cobra/command.go:974 +0x3bc
github.com/spf13/cobra.(*Command).Execute(...)
        /home/adam/go/src/gitlab.wikimedia.org/repos/releng/cli/vendor/github.com/spf13/cobra/command.go:902
gitlab.wikimedia.org/repos/releng/cli/cmd.Execute({0x133fa78, 0x407b99}, {0x133eca8, 0x401300}, {0x133ecb0, 0x0}, {0x133fa80, 0x7}, {0x1342ae0, 0x14}, ...)
        /home/adam/go/src/gitlab.wikimedia.org/repos/releng/cli/cmd/root.go:204 +0x69c
main.main()
        /home/adam/go/src/gitlab.wikimedia.org/repos/releng/cli/main.go:29 +0x85

The issue is that the mwcli now also deifnes this -v shorthand flag, but some commands also use this shorthand flag.

Addshore moved this task from Review to Pending Release on the mwcli board.