Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/go: set GOROOT explicitly for 'go generate' subprocesses
Code generators may reasonably expect to find the GOROOT for which the code is being generated. If the generator invokes 'go run' (which ought to be reasonable to do) and the user has set 'GOFLAGS=trimpath' (which also ought to be reasonable), then either 'go generate' or 'go run' needs to set GOROOT explicitly. I would argue that it is more appropriate for 'go generate' to set GOROOT than for 'go run' to do so, since a user may reasonably invoke 'go run' to reproduce a user-reported bug in a standalone Go program, but should not invoke 'go generate' except to regenerate code for a Go package. Updates golang#51461. Change-Id: Iceba233b4eebd57c40cf5dcd4af9031d210dc9d8 Reviewed-on: https://go-review.googlesource.com/c/go/+/399157 Run-TryBot: Bryan Mills <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Reviewed-by: Russ Cox <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
- Loading branch information