update description about vendoring in CONTRIBUTING.md (#18280)

* update description about vendoring in CONTRIBUTING.md

follow #18277

Signed-off-by: a1012112796 <1012112796@qq.com>

* Update CONTRIBUTING.md

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>

* fix and readd test-vendor step

* remove vendor from .gitattributes @silverwind

* simplify go mod check

Signed-off-by: a1012112796 <1012112796@qq.com>

* Revert "remove vendor from .gitattributes @silverwind"

This reverts commit 4789e704cb7a2c80934e4a4cd31efb161e6c8666.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
a1012112796 2022-01-18 02:39:07 +08:00 committed by GitHub
parent 076cead40d
commit 8581e2f4ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 9 deletions

View File

@ -91,13 +91,12 @@ Here's how to run the test suite:
## Vendoring ## Vendoring
We keep a cached copy of dependencies within the `vendor/` directory, We manage dependencies via [Go Modules](https://golang.org/cmd/go/#hdr-Module_maintenance), more details: [go mod](https://go.dev/ref/mod).
managing updates via [Modules](https://golang.org/cmd/go/#hdr-Module_maintenance).
Pull requests should only include `vendor/` updates if they are part of Pull requests should only include `go.mod`, `go.sum` updates if they are part of
the same change, be it a bugfix or a feature addition. the same change, be it a bugfix or a feature addition.
The `vendor/` update needs to be justified as part of the PR description, The `go.mod`, `go.sum` update needs to be justified as part of the PR description,
and must be verified by the reviewers and/or merger to always reference and must be verified by the reviewers and/or merger to always reference
an existing upstream commit. an existing upstream commit.

View File

@ -295,7 +295,7 @@ checks: checks-frontend checks-backend
checks-frontend: lockfile-check svg-check checks-frontend: lockfile-check svg-check
.PHONY: checks-backend .PHONY: checks-backend
checks-backend: swagger-check swagger-validate checks-backend: gomod-check swagger-check swagger-validate
.PHONY: lint .PHONY: lint
lint: lint-frontend lint-backend lint: lint-frontend lint-backend
@ -369,11 +369,12 @@ unit-test-coverage:
vendor: vendor:
$(GO) mod tidy && $(GO) mod vendor $(GO) mod tidy && $(GO) mod vendor
.PHONY: test-vendor .PHONY: gomod-check
test-vendor: vendor gomod-check:
@diff=$$(git diff vendor/); \ @$(GO) mod tidy
@diff=$$(git diff go.sum); \
if [ -n "$$diff" ]; then \ if [ -n "$$diff" ]; then \
echo "Please run 'make vendor' and commit the result:"; \ echo "Please run '$(GO) mod tidy' and commit the result:"; \
echo "$${diff}"; \ echo "$${diff}"; \
exit 1; \ exit 1; \
fi fi