]> Cypherpunks repositories - gostls13.git/commitdiff
[release-branch.go1] cmd/api: handle empty API file, ignore -next in release
authorRuss Cox <rsc@golang.org>
Wed, 13 Jun 2012 20:24:56 +0000 (16:24 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 13 Jun 2012 20:24:56 +0000 (16:24 -0400)
««« backport 8e7ad2db0833
cmd/api: handle empty API file, ignore -next in release

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6298063

»»»

src/cmd/api/goapi.go

index 3beb7d4b71435390cd9b834a2e1d43945d36560c..ad1c6bb8caed16dd964fee8f4bad87aeacc212cb 100644 (file)
@@ -28,6 +28,7 @@ import (
        "os/exec"
        "path"
        "path/filepath"
+       "runtime"
        "sort"
        "strconv"
        "strings"
@@ -99,6 +100,13 @@ func setContexts() {
 func main() {
        flag.Parse()
 
+       if !strings.Contains(runtime.Version(), "weekly") {
+               if *nextFile != "" {
+                       fmt.Printf("Go version is %q, ignoring -next %s\n", runtime.Version(), *nextFile)
+                       *nextFile = ""
+               }
+       }
+
        if *forceCtx != "" {
                setContexts()
        }
@@ -235,7 +243,11 @@ func fileFeatures(filename string) []string {
        if err != nil {
                log.Fatalf("Error reading file %s: %v", filename, err)
        }
-       return strings.Split(strings.TrimSpace(string(bs)), "\n")
+       text := strings.TrimSpace(string(bs))
+       if text == "" {
+               return nil
+       }
+       return strings.Split(text, "\n")
 }
 
 // pkgSymbol represents a symbol in a package