1
0
mirror of https://github.com/golang/go synced 2024-11-21 22:24:40 -07:00

cmd/api: handle empty API file, ignore -next in release

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6298063
This commit is contained in:
Russ Cox 2012-06-08 13:44:13 -04:00
parent 50452720ba
commit 0c2f0cca7c

View 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