Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gbbr/breakcheck
Backwards compatibility linter for Go.
https://github.com/gbbr/breakcheck
ci go golang lint linter semver
Last synced: 2 months ago
JSON representation
Backwards compatibility linter for Go.
- Host: GitHub
- URL: https://github.com/gbbr/breakcheck
- Owner: gbbr
- Created: 2019-04-13T11:36:24.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-04-15T09:51:41.000Z (over 5 years ago)
- Last Synced: 2024-10-15T08:31:30.773Z (3 months ago)
- Topics: ci, go, golang, lint, linter, semver
- Language: Go
- Homepage:
- Size: 43.9 KB
- Stars: 68
- Watchers: 5
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# breakcheck
breakcheck checks exported values, types and function declarations in your working tree for potential breaking changes against a given git reference.
## Usage
```
$ breakcheck --help
Example usage:
breakcheck # compares working tree against git head
breakcheck --base=v1.0.0 # compares against tag v1.0.0Flags:
-base string
git reference to compare against (default "head")
-private
include exported methods with private receivers
-v enable verbose mode
```## Example
Below is an example output from running breakcheck against the datadog-agent repository:
```
$ breakcheck --base=HEAD~40pkg/logs/config:
• Removed:
< integration_config.go:17@HEAD~40:
const ContainerdTypepkg/util/clusteragent:
• Struct field "ClusterAgentAPIEndpoint" removed in struct "DCAClient":
< clusteragent.go:42@HEAD~40:
struct DCAClient
> clusteragent.go:57:
struct DCAClient
• Struct field "ClusterAgentVersion" type changed from "string" to "version.Version":
< clusteragent.go:42@HEAD~40:
struct DCAClient
• Function return value (0) type changed from "*DCAClient" to "DCAClientInterface":
< clusteragent.go:60@HEAD~40:
func GetClusterAgentClient() (*DCAClient, error)
> clusteragent.go:75:
func GetClusterAgentClient() (DCAClientInterface, error)
```## Caveats
* If a function's argument is changed to an alias of the same type, breakcheck will fail to detect this and will report it as a change. Technically this is not a breaking change.
* Detecting changes in exported package level value declarations is limited to their name and type (when known).## Contributing
Contributions and feedback are very welcome, but please open an issue to discuss ideas before submitting to any work.
## Similar work
* https://golang.org/x/tools/internal/apidiff
* https://github.com/bradleyfalzon/apicompat