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

all: consistently use cpu_profile as flag name #895

Merged
merged 1 commit into from
Jan 17, 2025
Merged

Conversation

keegancsmith
Copy link
Member

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

Fixes #893

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
@keegancsmith keegancsmith requested a review from a team January 17, 2025 10:06
@keegancsmith
Copy link
Member Author

This change is part of the following stack:

Change managed by git-spice.

Copy link

@janhartman janhartman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bit of a shame that we have to do this - but like you said, this is a dev-only flag so it should be completely fine.

@keegancsmith keegancsmith merged commit 3287245 into main Jan 17, 2025
9 checks passed
@keegancsmith keegancsmith deleted the k/rename-flag branch January 17, 2025 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"flag redefined: cpuprofile" with sha1cd v0.3.1, avo v0.6.0
2 participants