Skip to content

Commit

Permalink
cmd/release: remove the tour from the releases
Browse files Browse the repository at this point in the history
This removes the tour from the release binary for go1.12.x and later
releases, lowering the size of each release. It will now redirect to
tour.golang.org, unless the user runs "go get -u golang.org/x/tour" to
cache it locally, in which case the local copy will be preferred.

The release size was 170.0 MiB for go1.11rc1, this change reduces the
size by 6.3 MiB, a 3.7% reduction. After this change, and others which
reduced the release size, the release candidate is now 115.2 MiB.

Updates golang/go#27151

Change-Id: I6687c34f3d4ae161c5e6df1f7af8cf3adc016fc4
Reviewed-on: https://go-review.googlesource.com/131156
Reviewed-by: Brad Fitzpatrick <[email protected]>
  • Loading branch information
katiehockman committed Aug 24, 2018
1 parent 2cb401a commit d32424d
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions cmd/release/releaselet.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,14 @@ var tourPackages = []string{
"wc",
}

// TODO: Remove after Go 1.13 is released, and Go 1.11 is no longer supported.
func tour() error {
_, version, _ := environ()
verMajor, verMinor, _ := splitVersion(version)
if verMajor > 1 || verMinor >= 12 {
return nil // Only include the tour in go1.11.x and earlier releases.
}

tourSrc := filepath.Join("gopath/src", tourPath)
contentDir := filepath.FromSlash("go/misc/tour")

Expand Down Expand Up @@ -262,7 +269,7 @@ func windowsMSI() error {
}

// Build package.
verMajor, verMinor, verPatch := wixVersion(version)
verMajor, verMinor, verPatch := splitVersion(version)

if err := runDir(win, filepath.Join(wix, "candle"),
"-nologo",
Expand Down Expand Up @@ -436,10 +443,10 @@ func ext() string {

var versionRe = regexp.MustCompile(`^go(\d+(\.\d+)*)`)

// wixVersion splits a Go version string such as "go1.9" or "go1.10.2" (as matched by versionRe)
// splitVersion splits a Go version string such as "go1.9" or "go1.10.2" (as matched by versionRe)
// into its three parts: major, minor, and patch
// It's based on the Git tag.
func wixVersion(v string) (major, minor, patch int) {
func splitVersion(v string) (major, minor, patch int) {
m := versionRe.FindStringSubmatch(v)
if m == nil {
return
Expand All @@ -463,7 +470,7 @@ func wixVersion(v string) (major, minor, patch int) {
// support is expected from the specified version.
// (WinXP is no longer supported starting Go v1.11)
func wixIsWinXPSupported(v string) bool {
major, minor, _ := wixVersion(v)
major, minor, _ := splitVersion(v)
if major > 1 {
return false
}
Expand Down Expand Up @@ -837,7 +844,7 @@ var windowsData = map[string]string{
// +build ignore. This is called by releaselet_test.go with an
// environment variable set, which func main above recognizes.
func runSelfTests() {
// Test wixVersion.
// Test splitVersion.
for _, tt := range []struct {
v string
major, minor, patch int
Expand All @@ -846,9 +853,9 @@ func runSelfTests() {
{"go1.34", 1, 34, 0},
{"go1.34.7", 1, 34, 7},
} {
major, minor, patch := wixVersion(tt.v)
major, minor, patch := splitVersion(tt.v)
if major != tt.major || minor != tt.minor || patch != tt.patch {
log.Fatalf("wixVersion(%q) = %v, %v, %v; want %v, %v, %v",
log.Fatalf("splitVersion(%q) = %v, %v, %v; want %v, %v, %v",
tt.v, major, minor, patch, tt.major, tt.minor, tt.patch)
}
}
Expand Down

0 comments on commit d32424d

Please sign in to comment.