fork of https://github.com/sourcegraph/zoekt
0

Configure Feed

Select the types of activity you want to include in your feed.

all: consistently use cpu_profile as flag name (#895)

This is more a workaround since a transitive dependency has introduced a
global flag "cpuprofile", leading to a panic due to registring the flag
twice.

To make ourselves immune to this issue we can refactor our usages to use
a FlagSet, even for "main". This is a bigger and frankly inconvenient
change for a somewhat rare occurance. Instead we just rename our flag.

I feel comfortable renaming since this flag should only really be used
by Zoekt developers. There will be the issue that the flag will be shown
twice for commands, but I will report to the upstream repo about this
problem.

Test Plan: go get -u ./... && go run ./cmd/zoekt-git-index works

+3 -3
+1 -1
cmd/zoekt-git-index/main.go
··· 46 46 deltaShardNumberFallbackThreshold := flag.Uint64("delta_threshold", 0, "upper limit on the number of preexisting shards that can exist before attempting a delta build (0 to disable fallback behavior)") 47 47 languageMap := flag.String("language_map", "", "a mapping between a language and its ctags processor (a:0,b:3).") 48 48 49 - cpuProfile := flag.String("cpuprofile", "", "write cpu profile to `file`") 49 + cpuProfile := flag.String("cpu_profile", "", "write cpu profile to `file`") 50 50 51 51 flag.Parse() 52 52
+2 -2
cmd/zoekt-test/main.go
··· 170 170 } 171 171 172 172 var ( 173 - memprofile = flag.String("memprofile", "", "write memory profile to `file`") 174 - cpuprofile = flag.String("cpuprofile", "", "write memory profile to `file`") 173 + memprofile = flag.String("mem_profile", "", "write memory profile to `file`") 174 + cpuprofile = flag.String("cpu_profile", "", "write cpu profile to `file`") 175 175 ) 176 176 177 177 func testLoadIndexDir(indexDir string) {