@@ -36,9 +36,6 @@ func main() {
36
36
if err := godoc (); err != nil {
37
37
log .Fatal (err )
38
38
}
39
- if err := tour (); err != nil {
40
- log .Fatal (err )
41
- }
42
39
if dir := archDir (); dir != "" {
43
40
if err := cp ("go/bin/go" , "go/bin/" + dir + "/go" ); err != nil {
44
41
log .Fatal (err )
@@ -51,22 +48,17 @@ func main() {
51
48
os .RemoveAll ("go/pkg/tool/linux_amd64" )
52
49
}
53
50
os .RemoveAll ("go/pkg/obj" )
54
- var err error
55
- switch runtime .GOOS {
56
- case "windows" :
51
+ if runtime .GOOS == "windows" {
57
52
// Clean up .exe~ files; golang.org/issue/23894
58
53
filepath .Walk ("go" , func (path string , fi os.FileInfo , err error ) error {
59
54
if strings .HasSuffix (path , ".exe~" ) {
60
55
os .Remove (path )
61
56
}
62
57
return nil
63
58
})
64
- err = windowsMSI ()
65
- case "darwin" :
66
- err = darwinPKG ()
67
- }
68
- if err != nil {
69
- log .Fatal (err )
59
+ if err := windowsMSI (); err != nil {
60
+ log .Fatal (err )
61
+ }
70
62
}
71
63
}
72
64
@@ -109,51 +101,6 @@ func godoc() error {
109
101
)
110
102
}
111
103
112
- const tourPath = "golang.org/x/tour"
113
-
114
- var tourContent = []string {
115
- "content" ,
116
- "solutions" ,
117
- "static" ,
118
- "template" ,
119
- }
120
-
121
- var tourPackages = []string {
122
- "pic" ,
123
- "reader" ,
124
- "tree" ,
125
- "wc" ,
126
- }
127
-
128
- // TODO: Remove after Go 1.13 is released, and Go 1.11 is no longer supported.
129
- func tour () error {
130
- _ , version , _ := environ ()
131
- verMajor , verMinor , _ := splitVersion (version )
132
- if verMajor > 1 || verMinor >= 12 {
133
- return nil // Only include the tour in go1.11.x and earlier releases.
134
- }
135
-
136
- tourSrc := filepath .Join ("gopath/src" , tourPath )
137
- contentDir := filepath .FromSlash ("go/misc/tour" )
138
-
139
- // Copy all the tour content to $GOROOT/misc/tour.
140
- if err := cpAllDir (contentDir , tourSrc , tourContent ... ); err != nil {
141
- return err
142
- }
143
-
144
- // Copy the tour source code so it's accessible with $GOPATH pointing to $GOROOT/misc/tour.
145
- tourPKGDir := filepath .Join (contentDir , "src" , tourPath )
146
- if err := cpAllDir (tourPKGDir , tourSrc , tourPackages ... ); err != nil {
147
- return err
148
- }
149
-
150
- // Copy the tour binary to the tool directory, invoked as "go tool tour".
151
- return cp (
152
- filepath .FromSlash ("go/pkg/tool/" + runtime .GOOS + "_" + runtime .GOARCH + "/tour" + ext ()),
153
- filepath .FromSlash ("gopath/bin/" + archDir ()+ "/tour" + ext ()),
154
- )
155
- }
156
-
157
104
func environ () (cwd , version string , err error ) {
158
105
cwd , err = os .Getwd ()
159
106
if err != nil {
@@ -168,75 +115,6 @@ func environ() (cwd, version string, err error) {
168
115
return
169
116
}
170
117
171
- func darwinPKG () error {
172
- cwd , version , err := environ ()
173
- if err != nil {
174
- return err
175
- }
176
-
177
- // Write out darwin data that is used by the packaging process.
178
- defer os .RemoveAll ("darwin" )
179
- if err := writeDataFiles (darwinData , "darwin" ); err != nil {
180
- return err
181
- }
182
-
183
- // Create a work directory and place inside the files as they should
184
- // be on the destination file system.
185
- work := filepath .Join (cwd , "darwinpkg" )
186
- if err := os .MkdirAll (work , 0755 ); err != nil {
187
- return err
188
- }
189
- defer os .RemoveAll (work )
190
-
191
- // Write out /etc/paths.d/go.
192
- const pathsBody = "/usr/local/go/bin"
193
- pathsDir := filepath .Join (work , "etc/paths.d" )
194
- pathsFile := filepath .Join (pathsDir , "go" )
195
- if err := os .MkdirAll (pathsDir , 0755 ); err != nil {
196
- return err
197
- }
198
- if err = ioutil .WriteFile (pathsFile , []byte (pathsBody ), 0644 ); err != nil {
199
- return err
200
- }
201
-
202
- // Copy Go installation to /usr/local/go.
203
- goDir := filepath .Join (work , "usr/local/go" )
204
- if err := os .MkdirAll (goDir , 0755 ); err != nil {
205
- return err
206
- }
207
- if err := cpDir (goDir , "go" ); err != nil {
208
- return err
209
- }
210
-
211
- // Build the package file.
212
- dest := "package"
213
- if err := os .Mkdir (dest , 0755 ); err != nil {
214
- return err
215
- }
216
- defer os .RemoveAll (dest )
217
-
218
- if err := run ("pkgbuild" ,
219
- "--identifier" , "com.googlecode.go" ,
220
- "--version" , version ,
221
- "--scripts" , "darwin/scripts" ,
222
- "--root" , work ,
223
- filepath .Join (dest , "com.googlecode.go.pkg" ),
224
- ); err != nil {
225
- return err
226
- }
227
-
228
- const pkg = "pkg" // known to cmd/release
229
- if err := os .Mkdir (pkg , 0755 ); err != nil {
230
- return err
231
- }
232
- return run ("productbuild" ,
233
- "--distribution" , "darwin/Distribution" ,
234
- "--resources" , "darwin/Resources" ,
235
- "--package-path" , dest ,
236
- filepath .Join (cwd , pkg , "go.pkg" ), // file name irrelevant
237
- )
238
- }
239
-
240
118
func windowsMSI () error {
241
119
cwd , version , err := environ ()
242
120
if err != nil {
@@ -527,63 +405,6 @@ func writeDataFiles(data map[string]string, base string) error {
527
405
return nil
528
406
}
529
407
530
- var darwinData = map [string ]string {
531
-
532
- "scripts/postinstall" : `#!/bin/bash
533
- GOROOT=/usr/local/go
534
- echo "Fixing permissions"
535
- cd $GOROOT
536
- find . -exec chmod ugo+r \{\} \;
537
- find bin -exec chmod ugo+rx \{\} \;
538
- find . -type d -exec chmod ugo+rx \{\} \;
539
- chmod o-w .
540
- ` ,
541
-
542
- "scripts/preinstall" : `#!/bin/bash
543
- GOROOT=/usr/local/go
544
- echo "Removing previous installation"
545
- if [ -d $GOROOT ]; then
546
- rm -r $GOROOT
547
- fi
548
- ` ,
549
-
550
- "Distribution" : `<?xml version="1.0" encoding="utf-8" standalone="no"?>
551
- <installer-script minSpecVersion="1.000000">
552
- <title>Go</title>
553
- <background mime-type="image/png" file="bg.png"/>
554
- <options customize="never" allow-external-scripts="no"/>
555
- <domains enable_localSystem="true" />
556
- <installation-check script="installCheck();"/>
557
- <script>
558
- function installCheck() {
559
- if(!(system.compareVersions(system.version.ProductVersion, '10.6.0') >= 0)) {
560
- my.result.title = 'Unable to install';
561
- my.result.message = 'Go requires Mac OS X 10.6 or later.';
562
- my.result.type = 'Fatal';
563
- return false;
564
- }
565
- if(system.files.fileExistsAtPath('/usr/local/go/bin/go')) {
566
- my.result.title = 'Previous Installation Detected';
567
- my.result.message = 'A previous installation of Go exists at /usr/local/go. This installer will remove the previous installation prior to installing. Please back up any data before proceeding.';
568
- my.result.type = 'Warning';
569
- return false;
570
- }
571
- return true;
572
- }
573
- </script>
574
- <choices-outline>
575
- <line choice="com.googlecode.go.choice"/>
576
- </choices-outline>
577
- <choice id="com.googlecode.go.choice" title="Go">
578
- <pkg-ref id="com.googlecode.go.pkg"/>
579
- </choice>
580
- <pkg-ref id="com.googlecode.go.pkg" auth="Root">com.googlecode.go.pkg</pkg-ref>
581
- </installer-script>
582
- ` ,
583
-
584
- "Resources/bg.png" : storageBase + "darwin/bg.png" ,
585
- }
586
-
587
408
// removeGodocShortcut removes the GODOC_SHORTCUT part out of the
588
409
// installer.wxs file contents.
589
410
func removeGodocShortcut () {
0 commit comments