Skip to content

cmd/go: generate uses runtime values of GOARCH and GOOS instead of buildContext values #16120

@nmiyake

Description

@nmiyake
  1. What version of Go are you using (go version)?
    go1.6.2
  2. What operating system and processor architecture are you using (go env)?
    darwin/amd64
  3. What did you do?
$ cat gen.go 
package test

//go:generate echo $GOOS
$ GOOS=linux go generate gen.go
  1. What did you expect to see?
    linux
  2. What did you see instead?
    darwin

This issue was raised as #11438 and fixed in Go 1.5, but the fix for #13124 caused a regression of this behavior in Go 1.6.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions