mirror of
https://github.com/golang/go
synced 2024-11-22 09:44:40 -07:00
cmd/api: add exception file
Fixes build. R=golang-dev, adg, bradfitz, dsymonds, dave CC=golang-dev https://golang.org/cl/6586074
This commit is contained in:
parent
e7f453148c
commit
d87d488953
@ -5,6 +5,9 @@ Each file is a list of of API features, one per line.
|
|||||||
go1.txt (and similarly named files) are frozen once a version has been
|
go1.txt (and similarly named files) are frozen once a version has been
|
||||||
shipped. Each file adds new lines but does not remove any.
|
shipped. Each file adds new lines but does not remove any.
|
||||||
|
|
||||||
|
except.txt lists features that may disappear without breaking
|
||||||
|
true compatibility. The only package there is text/template/parse.
|
||||||
|
|
||||||
next.txt is the only file intended to be mutated. It's a list of
|
next.txt is the only file intended to be mutated. It's a list of
|
||||||
features that may be added to the next version. It only affects
|
features that may be added to the next version. It only affects
|
||||||
warning output from the go api tool.
|
warning output from the go api tool.
|
||||||
|
2
api/except.txt
Normal file
2
api/except.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
pkg text/template/parse, type DotNode bool
|
||||||
|
pkg text/template/parse, type Node interface { Copy, String, Type }
|
@ -40,6 +40,7 @@ var (
|
|||||||
// list of files, rather than just one.
|
// list of files, rather than just one.
|
||||||
checkFile = flag.String("c", "", "optional filename to check API against")
|
checkFile = flag.String("c", "", "optional filename to check API against")
|
||||||
allowNew = flag.Bool("allow_new", true, "allow API additions")
|
allowNew = flag.Bool("allow_new", true, "allow API additions")
|
||||||
|
exceptFile = flag.String("except", "", "optional filename of packages that are allowed to change without triggering a failure in the tool")
|
||||||
nextFile = flag.String("next", "", "optional filename of tentative upcoming API features for the next release. This file can be lazily maintained. It only affects the delta warnings from the -c file printed on success.")
|
nextFile = flag.String("next", "", "optional filename of tentative upcoming API features for the next release. This file can be lazily maintained. It only affects the delta warnings from the -c file printed on success.")
|
||||||
verbose = flag.Bool("v", false, "verbose debugging")
|
verbose = flag.Bool("v", false, "verbose debugging")
|
||||||
forceCtx = flag.String("contexts", "", "optional comma-separated list of <goos>-<goarch>[-cgo] to override default contexts.")
|
forceCtx = flag.String("contexts", "", "optional comma-separated list of <goos>-<goarch>[-cgo] to override default contexts.")
|
||||||
@ -198,6 +199,13 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var exception = make(map[string]bool) // exception => true
|
||||||
|
if *exceptFile != "" {
|
||||||
|
for _, feature := range fileFeatures(*exceptFile) {
|
||||||
|
exception[feature] = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
take := func(sl *[]string) string {
|
take := func(sl *[]string) string {
|
||||||
s := (*sl)[0]
|
s := (*sl)[0]
|
||||||
*sl = (*sl)[1:]
|
*sl = (*sl)[1:]
|
||||||
@ -207,8 +215,13 @@ func main() {
|
|||||||
for len(required) > 0 || len(features) > 0 {
|
for len(required) > 0 || len(features) > 0 {
|
||||||
switch {
|
switch {
|
||||||
case len(features) == 0 || required[0] < features[0]:
|
case len(features) == 0 || required[0] < features[0]:
|
||||||
fmt.Fprintf(bw, "-%s\n", take(&required))
|
feature := take(&required)
|
||||||
|
if exception[feature] {
|
||||||
|
fmt.Fprintf(bw, "~%s\n", feature)
|
||||||
|
} else {
|
||||||
|
fmt.Fprintf(bw, "-%s\n", feature)
|
||||||
fail = true // broke compatibility
|
fail = true // broke compatibility
|
||||||
|
}
|
||||||
case len(required) == 0 || required[0] > features[0]:
|
case len(required) == 0 || required[0] > features[0]:
|
||||||
newFeature := take(&features)
|
newFeature := take(&features)
|
||||||
if optional[newFeature] {
|
if optional[newFeature] {
|
||||||
|
@ -112,7 +112,7 @@ time go run run.go
|
|||||||
|
|
||||||
echo
|
echo
|
||||||
echo '# Checking API compatibility.'
|
echo '# Checking API compatibility.'
|
||||||
go tool api -c $GOROOT/api/go1.txt -next $GOROOT/api/next.txt
|
go tool api -c $GOROOT/api/go1.txt -next $GOROOT/api/next.txt -except $GOROOT/api/except.txt
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo ALL TESTS PASSED
|
echo ALL TESTS PASSED
|
||||||
|
Loading…
Reference in New Issue
Block a user