Bug#1008114: Go packages are no longer reproducible with Go1.18

Shengjing Zhu zhsj at debian.org
Tue Mar 22 19:03:32 GMT 2022


Source: golang-1.18
Version: 1.18-1
Severity: normal
X-Debbugs-Cc: zhsj at debian.org, reproducible-bugs at lists.alioth.debian.org


For packages built with Go1.18, the build path is encoded in the binary now.

For example,

$ strings /usr/bin/gopls |grep /build/golang-golang-x-tools
build   CGO_CFLAGS="-g -O2 -ffile-prefix-map=/build/golang-golang-x-tools-0IC9YQ/golang-golang-x-tools-0.1.10+ds=. -fstack-protector-strong -Wformat -Werror=format-security"
build   CGO_CXXFLAGS="-g -O2 -ffile-prefix-map=/build/golang-golang-x-tools-0IC9YQ/golang-golang-x-tools-0.1.10+ds=. -fstack-protector-strong -Wformat -Werror=format-security"
build   CGO_CFLAGS="-g -O2 -ffile-prefix-map=/build/golang-golang-x-tools-0IC9YQ/golang-golang-x-tools-0.1.10+ds=. -fstack-protector-strong -Wformat -Werror=format-security"
build   CGO_CXXFLAGS="-g -O2 -ffile-prefix-map=/build/golang-golang-x-tools-0IC9YQ/golang-golang-x-tools-0.1.10+ds=. -fstack-protector-strong -Wformat -Werror=format-security"

This because Go1.18 starts to record the build flags. So people can check it with
`go version` command,

$ go version -m /usr/bin/gopls 
/usr/bin/gopls: go1.18
        path    golang.org/x/tools/gopls
        build   -compiler=gc
        build   CGO_ENABLED=1
        build   CGO_CFLAGS="-g -O2 -ffile-prefix-map=/build/golang-golang-x-tools-0IC9YQ/golang-golang-x-tools-0.1.10+ds=. -fstack-protector-strong -Wformat -Werror=format-security"
        build   CGO_CPPFLAGS="-Wdate-time -D_FORTIFY_SOURCE=2"
        build   CGO_CXXFLAGS="-g -O2 -ffile-prefix-map=/build/golang-golang-x-tools-0IC9YQ/golang-golang-x-tools-0.1.10+ds=. -fstack-protector-strong -Wformat -Werror=format-security"
        build   CGO_LDFLAGS=-Wl,-z,relro
        build   GOARCH=amd64
        build   GOOS=linux
        build   GOAMD64=v1



More information about the Reproducible-bugs mailing list