]> Cypherpunks repositories - gostls13.git/commitdiff
[release-branch.go1.4] cmd/api: make API check fail for undeclared API in release...
authorRuss Cox <rsc@golang.org>
Fri, 5 Dec 2014 19:04:17 +0000 (14:04 -0500)
committerDavid Symonds <dsymonds@golang.org>
Fri, 12 Dec 2014 04:37:58 +0000 (15:37 +1100)
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

src/cmd/api/goapi.go

index 568aec8c0b2374b6ec54800fd905be7cc3f878db..85988e3bb7e6103c2f4a917f37c4b973bdadb308 100644 (file)
@@ -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()