Skip to content

"flag redefined: cpuprofile" with sha1cd v0.3.1, avo v0.6.0 #893

@MarcWort

Description

@MarcWort

Hi, you are using github.com/pjbgf/sha1cd currently in verion 0.3.0. If upgraded to version 0.3.1 it also updates github.com/mmcloughlin/avo to v0.6.0, which defines the flag "cpuprofile" here also defined here:

cpuProfile := flag.String("cpuprofile", "", "write cpu profile to `file`")

Its probably a good idea to create some own FlagSet (NewFlagSet) or do some workaround to keep zoekt updatable in the future.

Maybe it would even be possible to remove the old workaround "cpu_profile" by doing it right this time and consolidate the cpuprofile argument.

cpuProfile := flag.String("cpu_profile", "", "write cpu profile to file")

Steps to reproduce

go get -u ./... && go run ./cmd/zoekt-git-index/

Output:

/tmp/go-build2071650996/b001/exe/zoekt-git-index flag redefined: cpuprofile
panic: /tmp/go-build2071650996/b001/exe/zoekt-git-index flag redefined: cpuprofile

goroutine 1 [running]:
flag.(*FlagSet).Var(0xc0000f6150, {0x13140e0, 0xc0002f70c0}, {0x10b0cbb, 0xa}, {0x11935ee, 0x1b})
        /opt/go/src/flag/flag.go:1028 +0x37d
flag.(*FlagSet).StringVar(...)
        /opt/go/src/flag/flag.go:879
flag.(*FlagSet).String(0xc0000f6150, {0x10b0cbb, 0xa}, {0x0, 0x0}, {0x11935ee, 0x1b})
        /opt/go/src/flag/flag.go:892 +0xa5
flag.String(...)
        /opt/go/src/flag/flag.go:899
main.run()
        /home/user/github/zoekt/cmd/zoekt-git-index/main.go:49 +0x25a
main.main()
        /home/user/github/zoekt/cmd/zoekt-git-index/main.go:146 +0x13

Metadata

Metadata

Assignees

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