flowerinthenight / golang-monorepo

An example of a golang-based monorepo.
MIT License
381 stars 36 forks source link

Handling dependency change if vendor is .gitignored? #2

Closed bzon closed 4 years ago

bzon commented 4 years ago

Some teams don't want to include the vendor directory in git and they prefer the CI system to download the dependencies during build time with caching (e.g in CircleCI).

What would be the best way to check if the git diff of $COMMIT_RANGE for Gopkg.lock (dep) or go.sum (go mod) modules should trigger a build for cmds and services?

flowerinthenight commented 4 years ago

I don't really have any best way of doing it at the moment as all of the Go projects I'm involved in so far always include the vendor directory. One possible way would be to start with the git diff of go.mod/go.sum, maybe use the info from go mod graph and you can somehow get the list of updated libs. Then same as the script here, use go list to determine the dependent packages and build them subsequently. Not sure if that's the best way though.