• Stars
    star
    177
  • Rank 208,281 (Top 5 %)
  • Language
    Go
  • License
    MIT License
  • Created almost 8 years ago
  • Updated about 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

apicompat checks recent changes to a Go project for backwards incompatible changes

Introduction

Build Status Coverage Status GoDoc

apicompat is a tool to check for the introduction of backwards incompatible changes.

apicompat:

  • Guarantees that all consumers of a library will still build without failure
  • Only checks exported declarations
  • There are no false positives (if there are, it's a bug)
  • Not every backwards incompatible change can be detected, swapping argument parameters and other changes still need to be considered by the library author
  • Can be simply consumed as a library
  • Is in its infancy, see Status, feedback and review appreciated
  • Was originally named abicheck during early development

Secondary tasks could include:

  • Detecting current semver and suggesting an appropriate increase
  • Listing all changes for help in writing release notes/commit messages.

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

Proposed Arguments

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.

Status

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):

  • Adding Mercurial, SVN and potentially other VCS systems
  • Improve VCS options such as:
    • Detection of VCS and flag to overwrite
    • Choosing base VCS path to allow running for a different directory
    • Filtering vendor/ directories (if this is the best place to do it, or leave it to go/type ast packages)
    • Check subdirectories if ran from a subdirectory of the VCS (currently checks all committed code)
  • Add docs, flow diagram and fixing of existing docs
  • Improve output formats (such as vim quickfix)
  • Move these tasks to GitHub issues
  • Once all other steps have been completed, performance will be investigated

Testing

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.

  • This uses golden master testdata/exp.txt for the tests
  • Run tests with: go test
  • Update master with: go test -args update
  • Alternatively to do a test run: go install && ( cd testgit; ./make.sh && apicompat )

More Repositories

1

ghinstallation

HTTP Round Tripper for GitHub Apps - Authenticate as an Installation Workflow
Go
288
star
2

tcp-fast-open

Golang example of TCP Fast Open (RFC7413)
Go
106
star
3

revgrep

Filters output from static analysis tools, showing only recently changed lines of code
Go
102
star
4

gopherci

GopherCI was a project to help you maintain high-quality Go projects, by checking each GitHub Pull Request, for backward incompatible changes, and a suite of other third party static analysis tools.
Go
102
star
5

tlsx

Unused Go package to inspect client hello message from Go application
Go
44
star
6

sha1affected

Checks whether a TLS connection uses SHA1 signed certificates, and if Google Chrome approves.
Go
17
star
7

docker-nmap-scans

Periodically scan target ranges using nmap, ndiff and emailing changes
Shell
10
star
8

udp-to-tcp

Naively change a UDP stream to TCP.
Go
9
star
9

gopherci-web

website for gopherci.io
Go
9
star
10

rfc-bot

A bot to autopost recently published RFCs to social media.
Go
7
star
11

h2push-demo

Demonstration of Go HTTP/2 Server Push via github.com/bradleyfalzon/net/http2 (fork of golang.org/x/net/http2)
JavaScript
6
star
12

ctxfix

ctxfix provides rudimentary rewriting to assist in migrating from golang.org/x/net/context to Go 1.7's context package
Go
5
star
13

aliasnimby

Alias Declarations - Not In My Backyard!
Go
5
star
14

go-release-cycle

Tool to generate a graph showing history of the Go releases
Go
4
star
15

cacti-influxdb

Export the last update value from RRD files by searching Cacti trees and inserting into influxDB
Go
3
star
16

lets-encrypt-example

Example of using Let's Encrypt's certbot with Go
Go
2
star
17

nsaudit

Load a list of domain names and verify check their NS settings (according to TLDs, not their own NS records)
Go
2
star
18

cryptval

cryptval helps to encrypt and decrypt database values in Go by implementing relevant database/sql interfaces.
Go
2
star
19

graphql-mergeable

An example Go application using GitHub's GraphQL API and https://github.com/shurcooL/githubql
Go
2
star
20

influxdb-anomaly

Importing data from InfluxDB, detect anomalies and breakouts and record in another table
Go
2
star
21

go-syscall-sockets

Testing some setsockopt options not available in standard go library
Go
2
star
22

packtpub-free-learning

Silly code golf to extract a title from the currently free learning packtpub offer
Go
2
star
23

maintainer.me

Maintainer.me - Filters GitHub watching notifications so you can focus on where you're useful.
Go
2
star
24

addgeoip

Read CSV for IP, lookup country in MaxMind GeoIP 2 Country DB, write new CSV with country added
Go
1
star
25

ghfilter

ghfilter provides primatives for filtering GitHub events.
Go
1
star
26

asm-playground

assembly playground
Assembly
1
star
27

mcrover

Why aren't personal robots getting Maccas for me?
Go
1
star
28

closecheck

Check for missing close method calls on objects that may require them - SEE EPILOGUE
Go
1
star
29

ws-stream

Go
1
star