@@ -72,13 +72,13 @@ func main() {
72
72
}
73
73
74
74
if (* rev == "" && * tarball == "" ) || (* rev != "" && * tarball != "" ) {
75
- log .Fatal ("must specify one of -rev and -tarball" )
76
- }
77
- if * toolsRev == "" {
78
- log .Fatal ("must specify -tools flag" )
75
+ log .Fatal ("must specify one of -rev or -tarball" )
79
76
}
80
77
if * version == "" {
81
- log .Fatal ("must specify -version flag" )
78
+ log .Fatal (`must specify -version flag (such as "go1.12" or "go1.13beta1")` )
79
+ }
80
+ if * toolsRev == "" && (versionIncludesGodoc (* version ) || versionIncludesTour (* version )) {
81
+ log .Fatal ("must specify -tools flag" )
82
82
}
83
83
84
84
coordClient = coordinatorClient ()
@@ -317,6 +317,9 @@ func (b *Build) make() error {
317
317
if r .repo == "tour" && ! versionIncludesTour (* version ) {
318
318
continue
319
319
}
320
+ if (r .repo == "net" || r .repo == "tools" ) && ! versionIncludesGodoc (* version ) {
321
+ continue
322
+ }
320
323
dir := goPath + "/src/golang.org/x/" + r .repo
321
324
tar := "https://go.googlesource.com/" + r .repo + "/+archive/" + r .rev + ".tar.gz"
322
325
if err := client .PutTarFromURL (tar , dir ); err != nil {
@@ -442,15 +445,18 @@ func (b *Build) make() error {
442
445
}
443
446
}
444
447
445
- toolPaths := []string {
446
- "golang.org/x/tools/cmd/godoc" ,
448
+ var toolPaths []string
449
+ if versionIncludesGodoc (* version ) {
450
+ toolPaths = append (toolPaths , "golang.org/x/tools/cmd/godoc" )
447
451
}
448
452
if versionIncludesTour (* version ) {
449
453
toolPaths = append (toolPaths , "golang.org/x/tour" )
450
454
}
451
- b .logf ("Building %v." , strings .Join (toolPaths , ", " ))
452
- if err := runGo (append ([]string {"install" }, toolPaths ... )... ); err != nil {
453
- return err
455
+ if len (toolPaths ) > 0 {
456
+ b .logf ("Building %v." , strings .Join (toolPaths , ", " ))
457
+ if err := runGo (append ([]string {"install" }, toolPaths ... )... ); err != nil {
458
+ return err
459
+ }
454
460
}
455
461
456
462
// postBuildCleanFiles are the list of files to remove in the go/ directory
@@ -839,3 +845,13 @@ func versionIncludesTour(goVer string) bool {
839
845
return strings .HasPrefix (goVer , "go1.10." ) ||
840
846
strings .HasPrefix (goVer , "go1.11." )
841
847
}
848
+
849
+ // versionIncludesGodoc reports whether the provided Go version (of the
850
+ // form "go1.N" or "go1.N.M" includes the godoc binary.
851
+ func versionIncludesGodoc (goVer string ) bool {
852
+ // We don't do releases of Go 1.10 and earlier, so this only
853
+ // needs to recognize the two current past releases. From Go
854
+ // 1.13 and on, we won't ship the godoc binary (see Issue 30029).
855
+ return strings .HasPrefix (goVer , "go1.11." ) ||
856
+ strings .HasPrefix (goVer , "go1.12." )
857
+ }
0 commit comments