99 "go/build"
1010 "log"
1111 "os"
12- "os/exec"
1312 "path/filepath"
1413 "runtime"
1514 "strconv"
@@ -334,14 +333,9 @@ func (b GolangCrossBuilder) Build() error {
334333
335334 buildCacheLocation := "/tmp/.cache/go-build"
336335 if CrossBuildMountBuildCache {
337- // Mount the go build cache into the container.
338- out , err := exec .Command ("go" , "env" , "GOCACHE" ).Output ()
339- if err != nil {
340- return fmt .Errorf ("failed to get GOCACHE: %w" , err )
341- }
342- cacheDir := strings .TrimSpace (string (out ))
336+ // Mount the go build cache volume into the container.
343337 args = append (args ,
344- "-v" , fmt .Sprintf ("%s:%s" , cacheDir , buildCacheLocation ),
338+ "-v" , fmt .Sprintf ("%s:%s" , CrossBuildBuildCacheVolumeName , buildCacheLocation ),
345339 )
346340 }
347341
@@ -368,7 +362,6 @@ func (b GolangCrossBuilder) Build() error {
368362 "--env" , fmt .Sprintf ("DEV=%v" , DevBuild ),
369363 "--env" , fmt .Sprintf ("EXTERNAL=%v" , ExternalBuild ),
370364 "--env" , fmt .Sprintf ("FIPS=%v" , FIPSBuild ),
371- "--user" , fmt .Sprintf ("%d:%d" , uid , gid ),
372365 "-v" , repoInfo .RootDir + ":" + mountPoint ,
373366 "-w" , workDir ,
374367 image ,
0 commit comments