cmd/go: Build fails when build with -trimpath due to lack of gcc #37158
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes, in both 1.13 and 1.14rc1
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
When one builds a Go binary inside Docker container (
golang:1.13.7-alpine3.10
) adding-trimpath
to the build command, fails the build if a C compiler wasn't pre-installed.Dockerfile:
The same code, with the same docker image, but w/o
-trimpath
builds successfully.What did you expect to see?
Expected, that
go build -trimpath
will have the same behaviour as one with no flag.What did you see instead?
Build fails, requiring gcc.
As was pointed out by @ianlancetaylor for a similar question on go-nuts 1, this is (likely) due to
runtime/cgo
needs to be rebuilt in order to trim the paths.I believe, there isn't any documentation or a note, describing this, so the change in go build's behaviour is surprising for a user.
The text was updated successfully, but these errors were encountered: