}
optional := fileFeatures(*nextFile)
exception := fileFeatures(*exceptFile)
- fail = !compareAPI(bw, features, required, optional, exception)
+ fail = !compareAPI(bw, features, required, optional, exception,
+ *allowNew && strings.Contains(runtime.Version(), "devel"))
}
// export emits the exported package features.
return spaceParensRx.ReplaceAllString(f, "")
}
-func compareAPI(w io.Writer, features, required, optional, exception []string) (ok bool) {
+func compareAPI(w io.Writer, features, required, optional, exception []string, allowAdd bool) (ok bool) {
ok = true
optionalSet := set(optional)
delete(optionalSet, newFeature)
} else {
fmt.Fprintf(w, "+%s\n", newFeature)
- if !*allowNew || !strings.Contains(runtime.Version(), "devel") {
+ if !allowAdd {
ok = false // we're in lock-down mode for next release
}
}
}
for _, tt := range tests {
buf := new(bytes.Buffer)
- gotok := compareAPI(buf, tt.features, tt.required, tt.optional, tt.exception)
+ gotok := compareAPI(buf, tt.features, tt.required, tt.optional, tt.exception, true)
if gotok != tt.ok {
t.Errorf("%s: ok = %v; want %v", tt.name, gotok, tt.ok)
}