summaryrefslogtreecommitdiff
path: root/src/cmd/api/goapi.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2012-06-08 13:44:13 -0400
committerRuss Cox <rsc@golang.org>2012-06-08 13:44:13 -0400
commit0c2f0cca7cc29a38e710f23fa752eecfa2368392 (patch)
treee196d1d88cb20853407cd6e93c1f9e822864b8a6 /src/cmd/api/goapi.go
parent50452720ba8a582d24870bfe0b4d1a97e6652f4f (diff)
downloadgo-git-0c2f0cca7cc29a38e710f23fa752eecfa2368392.tar.gz
cmd/api: handle empty API file, ignore -next in release
R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/6298063
Diffstat (limited to 'src/cmd/api/goapi.go')
-rw-r--r--src/cmd/api/goapi.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/cmd/api/goapi.go b/src/cmd/api/goapi.go
index 3beb7d4b71..ad1c6bb8ca 100644
--- a/src/cmd/api/goapi.go
+++ b/src/cmd/api/goapi.go
@@ -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