Skip to content

Commit

Permalink
cmd/release: don't ship race detector *.syso for other platforms
Browse files Browse the repository at this point in the history
Saves about 800k compressed, 2.2MB on disk.

Updates golang/go#27151

Change-Id: Ie78e02c3956b81c18643c80620f97612d55fdd23
Reviewed-on: https://go-review.googlesource.com/c/144281
Reviewed-by: Andrew Bonventre <andybons@golang.org>
  • Loading branch information
bradfitz committed Oct 24, 2018
1 parent 790500f commit bbe91e8
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions cmd/release/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,6 @@ var preBuildCleanFiles = []string{
"misc/makerelease",
}

var postBuildCleanFiles = []string{
"VERSION.cache",
"pkg/bootstrap",
}

func (b *Build) buildlet() (*buildlet.Client, error) {
b.logf("Creating buildlet.")
bc, err := coordClient.CreateBuildlet(b.Builder)
Expand Down Expand Up @@ -430,6 +425,29 @@ func (b *Build) make() error {
return err
}

// postBuildCleanFiles are the list of files to remove in the go/ directory
// after things have been built.
postBuildCleanFiles := []string{
"VERSION.cache",
"pkg/bootstrap",
}

// Remove race detector *.syso files for other GOOS/GOARCHes (except for the source release).
if !b.Source {
okayRace := fmt.Sprintf("race_%s_%s.syso", b.OS, b.Arch)
err := client.ListDir(".", buildlet.ListDirOpts{Recursive: true}, func(ent buildlet.DirEntry) {
name := strings.TrimPrefix(ent.Name(), "go/")
if strings.HasPrefix(name, "src/runtime/race/race_") &&
strings.HasSuffix(name, ".syso") &&
path.Base(name) != okayRace {
postBuildCleanFiles = append(postBuildCleanFiles, name)
}
})
if err != nil {
return fmt.Errorf("enumerating files to clean race syso files: %v", err)
}
}

b.logf("Cleaning goroot (post-build).")
if err := client.RemoveAll(addPrefix(goDir, postBuildCleanFiles)...); err != nil {
return err
Expand Down

0 comments on commit bbe91e8

Please sign in to comment.