Skip to content

Commit e6873ce

Browse files
committed
internal/task/releaselet: update for 1.21
Attempt to require Windows 10 in the installer for 1.21. Also use go.dev everywhere. This will take effect in the next minor releases. For golang/go#58028 Change-Id: I6786b0ec143fcec62f38d72fce0c8b1170c0e4e7 Reviewed-on: https://go-review.googlesource.com/c/build/+/478616 Run-TryBot: Heschi Kreinick <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Carlos Amedee <[email protected]>
1 parent 03942fc commit e6873ce

File tree

2 files changed

+26
-24
lines changed

2 files changed

+26
-24
lines changed

internal/task/releaselet/releaselet.go

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,15 @@ func windowsMSI() error {
108108
}
109109

110110
// Build package.
111-
verMajor, verMinor, verPatch := splitVersion(version)
111+
verMajor, verMinor := splitVersion(version)
112112

113113
fmt.Fprintln(os.Stderr, "running wix candle")
114114
if err := runDir(win, filepath.Join(wix, "candle"),
115115
"-nologo",
116116
"-arch", msArch(),
117117
"-dGoVersion="+version,
118-
fmt.Sprintf("-dWixGoVersion=%v.%v.%v", verMajor, verMinor, verPatch),
118+
fmt.Sprintf("-dGoMajorVersion=%v", verMajor),
119+
fmt.Sprintf("-dWixGoVersion=1.%v.%v", verMajor, verMinor),
119120
"-dArch="+runtime.GOARCH,
120121
"-dSourceDir="+goDir,
121122
filepath.Join(win, "installer.wxs"),
@@ -274,12 +275,11 @@ func ext() string {
274275
return ""
275276
}
276277

277-
var versionRe = regexp.MustCompile(`^go(\d+(\.\d+)*)`)
278+
var versionRe = regexp.MustCompile(`^go1\.(\d+(\.\d+)?)`)
278279

279280
// splitVersion splits a Go version string such as "go1.9" or "go1.10.2" (as matched by versionRe)
280-
// into its three parts: major, minor, and patch
281-
// It's based on the Git tag.
282-
func splitVersion(v string) (major, minor, patch int) {
281+
// into its parts: major and minor.
282+
func splitVersion(v string) (major, minor int) {
283283
m := versionRe.FindStringSubmatch(v)
284284
if m == nil {
285285
return
@@ -290,10 +290,6 @@ func splitVersion(v string) (major, minor, patch int) {
290290

291291
if len(parts) >= 2 {
292292
minor, _ = strconv.Atoi(parts[1])
293-
294-
if len(parts) >= 3 {
295-
patch, _ = strconv.Atoi(parts[2])
296-
}
297293
}
298294
}
299295
return
@@ -359,7 +355,7 @@ var windowsData = map[string]string{
359355
Name="Go Programming Language $(var.Arch) $(var.GoVersion)"
360356
Language="1033"
361357
Version="$(var.WixGoVersion)"
362-
Manufacturer="https://golang.org"
358+
Manufacturer="https://go.dev"
363359
UpgradeCode="$(var.UpgradeCode)" >
364360
365361
<Package
@@ -374,19 +370,25 @@ var windowsData = map[string]string{
374370
375371
<Property Id="ARPCOMMENTS" Value="The Go programming language is a fast, statically typed, compiled language that feels like a dynamically typed, interpreted language." />
376372
<Property Id="ARPCONTACT" Value="[email protected]" />
377-
<Property Id="ARPHELPLINK" Value="https://golang.org/help/" />
378-
<Property Id="ARPREADME" Value="https://golang.org" />
379-
<Property Id="ARPURLINFOABOUT" Value="https://golang.org" />
373+
<Property Id="ARPHELPLINK" Value="https://go.dev/help" />
374+
<Property Id="ARPREADME" Value="https://go.dev" />
375+
<Property Id="ARPURLINFOABOUT" Value="https://go.dev" />
380376
<Property Id="LicenseAccepted">1</Property>
381377
<Icon Id="gopher.ico" SourceFile="images\gopher.ico"/>
382378
<Property Id="ARPPRODUCTICON" Value="gopher.ico" />
383379
<Property Id="EXISTING_GOLANG_INSTALLED">
384380
<RegistrySearch Id="installed" Type="raw" Root="HKCU" Key="Software\GoProgrammingLanguage" Name="installed" />
385381
</Property>
386382
<MediaTemplate EmbedCab="yes" CompressionLevel="high" MaximumUncompressedMediaSize="10" />
383+
<?if $(var.GoMajorVersion < 21) ?>
387384
<Condition Message="Windows 7 (with Service Pack 1) or greater required.">
388385
((VersionNT > 601) OR (VersionNT = 601 AND ServicePackLevel >= 1))
389386
</Condition>
387+
<?else?>
388+
<Condition Message="Windows 10 or greater required.">
389+
(VersionNT >= 1000)
390+
</Condition>
391+
<?endif?>
390392
<MajorUpgrade AllowDowngrades="yes" />
391393
392394
<CustomAction
@@ -487,7 +489,7 @@ var windowsData = map[string]string{
487489
<Custom Action="SetApplicationRootDirectory" Before="InstallFinalize" />
488490
</InstallExecuteSequence>
489491
490-
<!-- Notify top level applications of the new PATH variable (golang.org/issue/18680) -->
492+
<!-- Notify top level applications of the new PATH variable (go.dev/issue/18680) -->
491493
<CustomActionRef Id="WixBroadcastEnvironmentChange" />
492494
493495
<!-- Include the user interface -->

internal/task/releaselet/releaselet_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ import (
1313
func TestSplitVersion(t *testing.T) {
1414
// Test splitVersion.
1515
for _, tt := range []struct {
16-
v string
17-
major, minor, patch int
16+
v string
17+
minor, patch int
1818
}{
19-
{"go1", 1, 0, 0},
20-
{"go1.34", 1, 34, 0},
21-
{"go1.34.7", 1, 34, 7},
19+
{"go1", 0, 0},
20+
{"go1.34", 34, 0},
21+
{"go1.34.7", 34, 7},
2222
} {
23-
major, minor, patch := splitVersion(tt.v)
24-
if major != tt.major || minor != tt.minor || patch != tt.patch {
25-
t.Errorf("splitVersion(%q) = %v, %v, %v; want %v, %v, %v",
26-
tt.v, major, minor, patch, tt.major, tt.minor, tt.patch)
23+
minor, patch := splitVersion(tt.v)
24+
if minor != tt.minor || patch != tt.patch {
25+
t.Errorf("splitVersion(%q) = %v, %v; want %v, %v",
26+
tt.v, minor, patch, tt.minor, tt.patch)
2727
}
2828
}
2929
}

0 commit comments

Comments
 (0)