apicompat
is a tool to check for the introduction of backwards incompatible changes.
apicompat
:
abicheck
during early developmentSecondary tasks could include:
Try at abicheck.bradleyf.id.au or via CLI:
go get -u github.com/bradleyfalzon/apicompat/cmd/apicompat
cd /your/project/dir/with/committed/changes
apicompat
apicompat
also comes with a command line tool, as well as being used as a library, the following are the proposed flags
and arguments for the command line tool.
-vcs (auto|git|svn|etc) - Version control system to use (default: auto)
-before revision - Revisions to check as before (default: if unstaged changes, check those, else check last two commits)
-after revision - Revisions to check as after (default: if unstaged changes, check those, else check last two commits)
-vcsDir path - Path to root VCS directory (default: let VCS tool search)
-all - Show non-breaking changes as well as breaking (default: false)
apicompat # current package only
apicompat ./... # check subdirectory packages
Another tool, called abichanges
may also be included which will list all detected changes to assist in producing
release notes.
apicompat
is currently under heavy development and refactoring. This initial version was a proof of concept and shortcuts were taken. The current tasks are focused on (but not limited to):
vendor/
directories (if this is the best place to do it, or leave it to go/type ast packages)This uses golden masters for the tests, currently (and only due to time constraints) testdata/
directory contains before.go
and after.go
, which are before and after versions of a test package, each time go test
is ran, the output is compared to
testdata/exp.txt
, which should not change.
If adding new test cases, you should expect the test to fail as the code changes should create a difference with exp.txt
.
Then, you'll need to update the golden master (see below), and commit those changes. If you add a new test case to before.go
and
after.go
, and the tests still pass, you've uncovered a bug within apicompat
which will need a code change to fix, once
code has change, the tests should fail, so update the master, review all your changes and commit.
testdata/exp.txt
for the testsgo test
go test -args update
go install && ( cd testgit; ./make.sh && apicompat )