Modcons is a CLI tool that inspects go.mod files for deprecated versions according to a set of deprecation rules.
For example:
github.com/myles-mcdonnell/blondie v1.0.0>=v3.0.0 #whitelist range equal or more than v1 less than v3
github.com/myles-mcdonnell/blondie =v0.8.0,v0.9.3 #whitelist v0.8.0 and v0.9.3
github.com/myles-mcdonnell/blondie !v1.5.7>=v1.8.3 #blacklist range equal or more than v1.5.7 less than 1.8.3
github.com/myles-mcdonnell/blondie !=v2.5.0 #blacklist
This project was initially named modcop until it was brought to my attention than a similar tool had already taken this name, which you can find here https://github.com/rogpeppe/modcop
The latest binaries for all supported operating systems are here
If you have Go tool installed you may also run:
go get -u github.com/go-tooling/modcons/...
Example CLI usage:
modcons --rulepath=http://my.domain.com/myrules.modcons --modpath=./go.mod --parseOnly=false
- Note that both path args may be local or http(s) urls.
parseOnly
will only parse the rule file and will not inspect the go.mod file- Both
modpath
andparseOnly
flag are optional, the default values are shown above - If any deprecated references are identified modcons exits with code 1.