gocompat is a tool to check compatibility between Go API versions.
gocompat considers an API as all exported symbols in a given set of packages as well as all exported symbols reachable from them. You can check this for the current package as follows:
gocompat reach .
gocompat can compare the API of two git references in a repository. For example:
gocompat compare v0.1.0 master ./...
There is almost no API change in Go that is fully backwards compatibility (see this post for more). By default, gocompat uses a strict approach in which most changes to exported symbols are considered incompatible.
However, most users will probably want to use compatibility guarantees analogous to the Go 1 compatibility promise. You can use the --go1compat
for that, which is a shorthand for --exclude=SymbolAdded --exclude=FieldAdded --exclude=MethodAdded
. For example:
gocompat compare --go1compat v1.0.0 v1.1.0 ./...
Released under the terms of the Apache License Version 2.0, see LICENSE.