Skip to content
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

cmd/go: generate passes incorrect GOPACKAGE env var to XTest files #24594

Closed
myitcv opened this issue Mar 29, 2018 · 1 comment
Closed

cmd/go: generate passes incorrect GOPACKAGE env var to XTest files #24594

myitcv opened this issue Mar 29, 2018 · 1 comment
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@myitcv
Copy link
Member

myitcv commented Mar 29, 2018

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.10 linux/amd64
go version devel +7fe2f549cc Thu Mar 29 07:03:09 2018 +0000 linux/amd64

Does this issue reproduce with the latest release?

Yes; and tip.

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/myitcv/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/myitcv/gostuff"
GORACE=""
GOROOT="/home/myitcv/gos"
GOTMPDIR=""
GOTOOLDIR="/home/myitcv/gos/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build527944703=/tmp/go-build -gno-record-gcc-switches"

What did you do?

cd `mktemp -d`
cat <<EOD > main_test.go
package main_test

//go:generate echo \$GOPACKAGE

EOD
go generate

The go generate command will output a line of text.

What did you expect to see?

main_test

What did you see instead?

main

/cc @robpike

I'm putting together a CL with a potential fix (and test case)

@myitcv myitcv changed the title cmd/go: generate provides incorrect GOPACKAGE env var to XTest files cmd/go: generate passes incorrect GOPACKAGE env var to XTest files Mar 29, 2018
@gopherbot
Copy link

Change https://golang.org/cl/103415 mentions this issue: cmd/go: make generate pass correct GOPACKAGE to XTest files

@ianlancetaylor ianlancetaylor added the NeedsFix The path to resolution is known, but the work has not been done. label Mar 29, 2018
@ianlancetaylor ianlancetaylor added this to the Go1.11 milestone Mar 29, 2018
@golang golang locked and limited conversation to collaborators Mar 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants