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

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

cmd/go: cache is not aware of go build -trimpath flag #31896

tv42 opened this issue May 7, 2019 · 3 comments
Labels
FrozenDueToAge GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Milestone

Comments

@tv42
Copy link

tv42 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
Copy link
Contributor

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

@josharian josharian added GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels May 7, 2019
@josharian josharian added this to the Go1.13 milestone May 7, 2019
@gopherbot
Copy link

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

@cespare
Copy link
Contributor

cespare 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.

@golang golang locked and limited conversation to collaborators May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Projects
None yet
Development

No branches or pull requests

5 participants