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
proposal: let go generate pass through calling go binary #28250
Comments
Change https://golang.org/cl/142887 mentions this issue: |
Maybe instead we should put the effective GOROOT/bin at the head of the PATH during go generate invocation? Then all the existing files that say 'go run' work fine instead of needing to teach everyone to write $GO. |
Note that we just rejected having a $GOCMD that go/packages would look at, for the same reason: we want $PATH to be the single way to control which go you run, instead of having two variables. |
Related #28103
…On Wed, Oct 17, 2018 at 10:39 AM Russ Cox ***@***.***> wrote:
Note that we just rejected having a $GOCMD that go/packages would look at, for the same reason: we want $PATH to be the single way to control which go you run, instead of having two variables.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
This seems sane and would fix the issue I ran into with fewer changes on my part. |
Closing in favor of #28103 |
I ran into an issue recently where I was using Go 1.11 features in an application but had Go 1.10 installed on the system. To build I was installing Go 1.11 via
go get golang.org/dl/go1.11 && go1.11 download
and then starting my build by calling go generate. My code generation also requires Go 1.11, but thego:generate
line looks something like this:However, this uses the version of Go on the system and the build fails because it needs to be using Go 1.11. I can't simply change this to
go1.11 run gen.go
because on other systems it's being built on (most of them, in fact) Go 1.11 is the default and I'm not downloading it fromgolang.org/dl
.To work around this, I've moved generation out into a script:
and changed the generate line to invoke this:
However, this only works if
/proc
is mounted which feels poor.It would be nice if the Go binary that ran generate could be passed in for substitution, eg. maybe as
$GO
. This way the same binary could be invoked:The text was updated successfully, but these errors were encountered: