-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
x/review/git-codereview: when working on the Go repo, use its bin/gofmt if present #26336
Comments
Change https://golang.org/cl/130695 mentions this issue: |
This is not obvious to me. Why is GOROOT better than PATH in this context? We go to pains to tell people not to set the GOROOT env var, as it is a source of significant confusion. (This is one of @davecheney's favorites.) And tools that memorize the toolchain that they were built with are really frustrating. It seems to me that using the gofmt in your PATH is the best available solution. Or at most fixing #27166 and then using the results of that. |
Seems like this needs further discussion. Re-labelled appropriately. |
I presume @FiloSottile meant something like Though I generally agree with Josh. We tell people that to "select" which Go version should be used, they should modify |
git-codereview implies you are submitting code to the repository you are working on. If that repository is the go tree, you should use the gofmt that come with it. |
Right, so this would only apply to the Go repo itself, using that clone's |
Agreed, that was the poorly worded intention. |
@ekalinin - Could you please update the CL according to the logic discussed above ? Thanks. |
gofmt changed in Go 1.11, and git-codereview uses the gofmt from $PATH, so when that's the Go 1.10 version, it complains as
git-codereview: gofmt needs to format these files (run 'git gofmt')
.It should instead use the gofmt in GOROOT.
The text was updated successfully, but these errors were encountered: