Skip to content

Commit

Permalink
cmd/release: set the minimum macOS version supported by Go 1.13
Browse files Browse the repository at this point in the history
Set the minmacos version depending on the version of go being packaged
for macOS releases. Removed support for Go 1.12 since it is no longer
supported.

Fixes golang/go#36846
Updates golang/go#35459

Change-Id: Ifb9a0296fde5ed87da72d7719a714744484cc7db
Reviewed-on: https://go-review.googlesource.com/c/build/+/221100
Run-TryBot: Carlos Amedee <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
Reviewed-by: Alexander Rakoczy <[email protected]>
  • Loading branch information
cagedmantis committed Feb 26, 2020
1 parent 5b56222 commit 7ece5da
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
16 changes: 5 additions & 11 deletions cmd/release/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,7 @@ func (b *Build) make() error {
}

// Issues #36025 #35459
// TODO (amedee): remove check for go1.14 once #36845 and #36846 are resolved.
if b.OS == "darwin" && b.Arch == "amd64" && strings.HasPrefix(*version, "go1.14") {
if b.OS == "darwin" && b.Arch == "amd64" {
minMacVersion := minSupportedMacOSVersion(*version)
env = append(env, fmt.Sprintf("CGO_CFLAGS=-mmacosx-version-min=%s", minMacVersion))
}
Expand Down Expand Up @@ -886,22 +885,17 @@ func setGOARCH(env []string, goarch string) []string {
}

// minSupportedMacOSVersion provides the minimum supported macOS
// version (of the form N.M) for each version of Go >= go1.12.
// version (of the form N.M) for supported Go versions.
func minSupportedMacOSVersion(goVer string) string {
// TODO(amedee): Use a version package to compare versions of Go.

// The minimum supported version of macOS with each version of go:
// go1.12 - macOS 10.10
// go1.13 - macOS 10.11
// go1.14 - macOS 10.11
// go1.15 - macOS 10.12
minMacVersion := "10.11"
if strings.HasPrefix(goVer, "go1.12.") {
minMacVersion = "10.10"
return minMacVersion
}
if strings.HasPrefix(goVer, "go1.15") {
minMacVersion = "10.12"
minMacVersion := "10.12"
if strings.HasPrefix(goVer, "go1.13") || strings.HasPrefix(goVer, "go1.14") {
minMacVersion = "10.11"
return minMacVersion
}
return minMacVersion
Expand Down
1 change: 0 additions & 1 deletion cmd/release/release_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ func TestMinSupportedMacOSVersion(t *testing.T) {
goVer string
wantMacOS string
}{
{"patch_release_12", "go1.12.1", "10.10"},
{"minor_release_13", "go1.13", "10.11"},
{"minor_release_14", "go1.14", "10.11"},
{"rc_release_13", "go1.13rc1", "10.11"},
Expand Down

0 comments on commit 7ece5da

Please sign in to comment.