diff options
author | Russ Cox <rsc@golang.org> | 2014-12-05 14:04:17 -0500 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2014-12-05 14:04:17 -0500 |
commit | 355e7d7e8d706aeacce82120b3ab94a4f9fd1a46 (patch) | |
tree | b28cf9ab1b36a7983367ff514754543b6e9445c8 | |
parent | fd7061f08cc1733b7100465d92bda51e162315b4 (diff) | |
download | go-355e7d7e8d706aeacce82120b3ab94a4f9fd1a46.tar.gz |
[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://codereview.appspot.com/185050043
-rw-r--r-- | src/cmd/api/goapi.go | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/cmd/api/goapi.go b/src/cmd/api/goapi.go index 5a8c87603..4a63eac71 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() |