Skip to content

Commit

Permalink
Fix build process.
Browse files Browse the repository at this point in the history
Add GOCACHE env variable, as required by Go 1.12.
  • Loading branch information
bjornleffler committed Mar 27, 2019
1 parent 4cf4ba3 commit 9fa0cc8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/build_gcsfuse/main.go
Expand Up @@ -79,6 +79,7 @@ func buildBinaries(
err = fmt.Errorf("TempDir: %v", err)
return
}
defer os.RemoveAll(gopath)

// Create a directory to become GOCACHE for our build below.
var gocache string
Expand All @@ -87,8 +88,7 @@ func buildBinaries(
err = fmt.Errorf("TempDir: %v", err)
return
}

defer os.RemoveAll(gopath)
defer os.RemoveAll(gocache)

// Make it appear as if the source directory is at the appropriate position
// in $GOPATH.
Expand Down
10 changes: 10 additions & 0 deletions tools/package_gcsfuse/build.go
Expand Up @@ -33,6 +33,15 @@ func build(
osys string) (dir string, err error) {
log.Printf("Building version %s from %s.", version, commit)

// Create a directory to become GOCACHE below.
var gocache string
gocache, err = ioutil.TempDir("", "package_gcsfuse_gocache")
if err != nil {
err = fmt.Errorf("TempDir: %v", err)
return
}
defer os.RemoveAll(gocache)

// Create a directory to hold our outputs. Kill it if we later return in
// error.
dir, err = ioutil.TempDir("", "package_gcsfuse_build")
Expand Down Expand Up @@ -90,6 +99,7 @@ func build(
cmd.Env = []string{
"GO15VENDOREXPERIMENT=1",
fmt.Sprintf("GOROOT=%s", runtime.GOROOT()),
fmt.Sprintf("GOCACHE=%s", gocache),
"GOPATH=/does/not/exist",
}

Expand Down

0 comments on commit 9fa0cc8

Please sign in to comment.