go get github.com/joesonw/go-diff
This little handy tool helps to manage large mono repositories. You don't have to rebuild every single service upon each little update.
This will help you to find out which services should be updated.
Only works with GO MODULES
ATM
go-diff -repo github.com/user/repo -branch master -from <HASH> -to <HASH>
or use
-repo file:///path/to/your/local/repo
to avoid cloning
- It clones your repo
- It then checkouts into specified branch.
- It then does a diff between two hashes.
- It will add any changed
.go
files to the change list - It compares two
go.sum
files and compute changed libraries, then added to change list - It parses every
.go
file and find import dependencies. - It adds every file that imported any package from change list, and does over and over again, until nothing new isfound.
- TADA! You have a list of packages that needed to be rebuilt.
https://github.com/dstreamcloud/diff-sample/tree/go
go-diff -repo https://github.com/dstreamcloud/diff-sample -branch go -from 1d748721adb49b79a529e446cca4b1a21bdd9b13 -to 4170f40939e939372e5c55beacd6a69ead53b976
This diff only changed pkg/critical/critical.go
. But all packages are considered changed.
go-diff -repo https://github.com/dstreamcloud/diff-sample -branch go -from 4170f40939e939372e5c55beacd6a69ead53b976 -to 6597f05c8b41f1182ad4fba09720728ada22a7fa
This diff only updated dependency of logrus. Thus only pkg/logrus
and root which depends on it are considered changed.