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: cache is not aware of go build -trimpath flag #31896

Open
tv42 opened this issue May 7, 2019 · 3 comments

Comments

Projects
None yet
5 participants
@tv42
Copy link

commented May 7, 2019

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

$ go-tip version
go version devel +dc0388c565 2019-05-07 18:42:17 +0000 linux/amd64

Does this issue reproduce with the latest release?

Latest release does not yet include the feature, 7469564

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

go env Output
$ go-tip env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/tv/.cache/go-build"
GOENV="/home/tv/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/tv/go"
GOPROXY="direct"
GOROOT="/home/tv/src/go"
GOSUMDB="off"
GOTMPDIR=""
GOTOOLDIR="/home/tv/src/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/tv/src/2019/escape-string/go.mod"
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=/home/tv/tmp/go-build475315987=/tmp/go-build -gno-record-gcc-switches"

What did you do?

  • Got excited about 7469564
  • Constructed a test case (trivial main.go and go.mod).
  • go build
  • strings appname | grep /home/, saw paths listed
  • go build -trimpath
  • strings appname | grep /home/, still saw paths listed
  • go clean -cache
  • go build -trimpath
  • strings appname | grep /home/, was empty as expected

What did you expect to see?

Empty results from grep even before cleaning the cache.

What did you see instead?

Build cache being ignorant about the presence of the -trimpath flag.

@josharian

This comment has been minimized.

Copy link
Contributor

commented May 7, 2019

I also got excited about -trimpath, found that it didn't improve build times for go-fuzz, and got distracted before investigating further. This would explain it. Thanks for filing the issue, @tv42!

cc @bcmills @rsc @jayconrod

@gopherbot

This comment has been minimized.

Copy link

commented May 9, 2019

Change https://golang.org/cl/176112 mentions this issue: cmd/go: teach the build cache about -trimpath

@cespare

This comment has been minimized.

Copy link
Contributor

commented May 9, 2019

I was digging around in this code today anyway so I sent a drive-by CL. I wasn't sure how to write tests, though (there are no tests for go build -trimpath) -- if anyone has ideas, please let me know on the CL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.