-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: go install -race std installs "slow" gofmt #7226
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
Labels
Milestone
Comments
You are right. If $GOROOT/pkg/linux_amd64_race exists, go install -race std doesn't overwrite $GOROOT/bin/gofmt, so users of the binary distribution aren't affected. If it doesn't, gofmt is replaced by a race-enabled one. Other than hacking on the go tool, maybe do this: There was an issue somewhere to add a function to runtime to tell if the race detector is on. If that exists yet, maybe gofmt can just print a warning to stderr: "gofmt is built with the race detector enabled and will be slow". Alternatively, you could add a +build race file to do this. |
after running make.bash, go install -race std overwrites an existing fast gofmt with a slow race-enabled one. I mainly do this because of an old habit caused by issue #5048, but other people might also run this for other reasons. Once you've done this, you have a slow gofmt and it's hard to figure out why if you only notice it for the first time a few hours after fiddling with the race detector. |
Re #9, no. misc/dist takes care of this problem by reinstalling all the commands. I don't think we can change the behavior for "go install -race std" now, however, we might consider add a new stdlib selector for standard packages (but not commands). However, I'm not sure about name conflicts that might cause. |
The only people who actually want to run these tools with race detection enabled are Go core developers. It does kinda suck that building the race toolchain also builds the tools. I like fullung's proposed solution in #2. It's just the go tool and gofmt that need to print the warning. Doesn't seem like a big deal to me, provided that the proposed runtime.RaceEnabled const/function is acceptable. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: