问题
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?
来源:https://stackoverflow.com/questions/61531189/does-it-make-sense-to-add-go-mod-vendor-to-a-pre-commit-hook