Commit ab9c25f2 authored by Andrew Gerrand's avatar Andrew Gerrand

cmd/go: use GOOS and GOARCH from build context for "go generate"

Fixes #11438

Change-Id: Iedd31918aa5187fc3fdaed71c8dad82075559084
Reviewed-on: https://go-review.googlesource.com/11667Reviewed-by: default avatarRob Pike <r@golang.org>
parent b8d2d6b9
...@@ -347,9 +347,9 @@ func (g *Generator) errorf(format string, args ...interface{}) { ...@@ -347,9 +347,9 @@ func (g *Generator) errorf(format string, args ...interface{}) {
func (g *Generator) expandVar(word string) string { func (g *Generator) expandVar(word string) string {
switch word { switch word {
case "GOARCH": case "GOARCH":
return runtime.GOARCH return buildContext.GOARCH
case "GOOS": case "GOOS":
return runtime.GOOS return buildContext.GOOS
case "GOFILE": case "GOFILE":
return g.file return g.file
case "GOLINE": case "GOLINE":
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment