• David Crawshaw's avatar
    cmd/go: put computed GOROOT in built binaries · 06f4d936
    David Crawshaw authored
    As of CL 42533, cmd/go will recompute its GOROOT based on the
    location of its own executable. This CL plumbs that computed GOROOT
    into every binary it builds using the linker -X flag. This
    means binaries built with a moved cmd/go will report the GOROOT
    they were built in from runtime.GOROOT().
    
    Fixes #21313
    
    Change-Id: I6c2c559f40f2a0c867ab60cf47c6dbc73ae5e28a
    Reviewed-on: https://go-review.googlesource.com/61310
    Run-TryBot: David Crawshaw <crawshaw@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
    06f4d936
buildruntime.go 2.68 KB