aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-12-05 14:04:17 -0500
committerDavid Symonds <dsymonds@golang.org>2014-12-12 15:37:58 +1100
commitbd8077116e2fe04306fc75ed1bd1eb3586b9cd1d (patch)
tree3494764478fb3b999bb91d5781e631426056c792 /src
parent77e96c9208d037157c31012c4db192c8b56c6c43 (diff)
downloadgo-bd8077116e2fe04306fc75ed1bd1eb3586b9cd1d.tar.xz
[release-branch.go1.4] cmd/api: make API check fail for undeclared API in release branch
We forgot to do the usual API review. Make that not possible in the future. I'll pull this change over to the main branch too, but it's more important (and only testable) here. LGTM=bradfitz R=bradfitz CC=golang-codereviews https://golang.org/cl/185050043
Diffstat (limited to 'src')
-rw-r--r--src/cmd/api/goapi.go14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/cmd/api/goapi.go b/src/cmd/api/goapi.go
index 568aec8c0b..85988e3bb7 100644
--- a/src/cmd/api/goapi.go
+++ b/src/cmd/api/goapi.go
@@ -283,7 +283,7 @@ func compareAPI(w io.Writer, features, required, optional, exception []string) (
delete(optionalSet, newFeature)
} else {
fmt.Fprintf(w, "+%s\n", newFeature)
- if !*allowNew {
+ if !*allowNew || !strings.Contains(runtime.Version(), "devel") {
ok = false // we're in lock-down mode for next release
}
}
@@ -313,11 +313,15 @@ func fileFeatures(filename string) []string {
if err != nil {
log.Fatalf("Error reading file %s: %v", filename, err)
}
- text := strings.TrimSpace(string(bs))
- if text == "" {
- return nil
+ lines := strings.Split(string(bs), "\n")
+ var nonblank []string
+ for _, line := range lines {
+ line = strings.TrimSpace(line)
+ if line != "" && !strings.HasPrefix(line, "#") {
+ nonblank = append(nonblank, line)
+ }
}
- return strings.Split(text, "\n")
+ return nonblank
}
var fset = token.NewFileSet()