From: Russ Cox Date: Fri, 5 Dec 2014 19:04:17 +0000 (-0500) Subject: [release-branch.go1.4] cmd/api: make API check fail for undeclared API in release... X-Git-Tag: go1.4~12 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=75c8a78e61617f845c95abb01d7680aae60069ad;p=gostls13.git [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 --- diff --git a/src/cmd/api/goapi.go b/src/cmd/api/goapi.go index 5a8c876033..4a63eac713 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()