Setup:
- Our project is using
golang 1.12.14
- We are using
go build -mod=vendor
Issue: When new dependencies are added to go.mod
the vendor folder isn't updated and people are committing code and forgetting to run go mod vendor
to update the folder. My understanding is that since -mod=vendor
specifies to use packages from the vendor
folder, the go.mod
file will have discrepancies from what we are actually using when building the project.
Question: Should go mod vendor
be added to a pre-commit hook?
git rm -rf vendor
, and usego mod
as intended. – Moneyermod
here which makes me think I have the wrong idea github.com/dnephin/pre-commit-golang – StultzWhen the main module contains a top-level vendor directory and its go.mod file specifies go 1.14 or higher, the go command now defaults to -mod=vendor
golang.org/doc/go1.14 – Stultzgo mod vendor
works) the default proxy is extremely fast, and sometimes faster than committing large dependency trees to git. – Kob-mod
is irrelevant. – Moneyer