From dc9a3dfa851c8516404a2074007faba4dd1b110e Mon Sep 17 00:00:00 2001 From: a1012112796 <1012112796@qq.com> Date: Sat, 15 Jan 2022 18:13:16 +0800 Subject: [PATCH 1/6] update description about vendoring in CONTRIBUTING.md follow #18277 Signed-off-by: a1012112796 <1012112796@qq.com> --- CONTRIBUTING.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fad535bb2ac3..73c0ba278ee5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -91,13 +91,12 @@ Here's how to run the test suite: ## Vendoring -We keep a cached copy of dependencies within the `vendor/` directory, -managing updates via [Modules](https://golang.org/cmd/go/#hdr-Module_maintenance). +We 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 `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 an existing upstream commit. From 8a6b1d05bae27ce4c9a256c40e349498054fe3c5 Mon Sep 17 00:00:00 2001 From: a1012112796 <1012112796@qq.com> Date: Sat, 15 Jan 2022 19:01:24 +0800 Subject: [PATCH 2/6] Update CONTRIBUTING.md Co-authored-by: wxiaoguang --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 73c0ba278ee5..624896bbaacd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -91,7 +91,7 @@ Here's how to run the test suite: ## Vendoring -We managing updates via [Modules](https://golang.org/cmd/go/#hdr-Module_maintenance). +We manage dependencies via [Go Modules](https://golang.org/cmd/go/#hdr-Module_maintenance), more details: [go mod](https://go.dev/ref/mod). 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. From 686e8ded28dc73f7921a3b72175926b70d801e5f Mon Sep 17 00:00:00 2001 From: a1012112796 <1012112796@qq.com> Date: Sat, 15 Jan 2022 19:26:43 +0800 Subject: [PATCH 3/6] fix and readd test-vendor step --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index ca273fd50735..3bea273b10cf 100644 --- a/Makefile +++ b/Makefile @@ -295,7 +295,7 @@ checks: checks-frontend checks-backend checks-frontend: svg-check .PHONY: checks-backend -checks-backend: swagger-check swagger-validate +checks-backend: test-vendor swagger-check swagger-validate .PHONY: lint lint: lint-frontend lint-backend @@ -371,7 +371,7 @@ vendor: .PHONY: test-vendor test-vendor: vendor - @diff=$$(git diff vendor/); \ + @diff=$$(git diff go.mod go.sum); \ if [ -n "$$diff" ]; then \ echo "Please run 'make vendor' and commit the result:"; \ echo "$${diff}"; \ From 4789e704cb7a2c80934e4a4cd31efb161e6c8666 Mon Sep 17 00:00:00 2001 From: a1012112796 <1012112796@qq.com> Date: Sun, 16 Jan 2022 10:01:45 +0800 Subject: [PATCH 4/6] remove vendor from .gitattributes @silverwind --- .gitattributes | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index 05dde22cccb4..17d4c3d8afd3 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,4 @@ * text=auto eol=lf -/vendor/** -text -eol linguist-vendored /public/vendor/** -text -eol linguist-vendored /templates/**/*.tmpl linguist-language=Handlebars /.eslintrc linguist-language=YAML From 6aef0e895a2bcc5f84c06d63dd9505e2c684a587 Mon Sep 17 00:00:00 2001 From: a1012112796 <1012112796@qq.com> Date: Sun, 16 Jan 2022 20:27:48 +0800 Subject: [PATCH 5/6] simplify go mod check Signed-off-by: a1012112796 <1012112796@qq.com> --- Makefile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 0cd0d8fe6b35..342366492c7b 100644 --- a/Makefile +++ b/Makefile @@ -295,7 +295,7 @@ checks: checks-frontend checks-backend checks-frontend: lockfile-check svg-check .PHONY: checks-backend -checks-backend: test-vendor swagger-check swagger-validate +checks-backend: gomod-check swagger-check swagger-validate .PHONY: lint lint: lint-frontend lint-backend @@ -369,11 +369,12 @@ unit-test-coverage: vendor: $(GO) mod tidy && $(GO) mod vendor -.PHONY: test-vendor -test-vendor: vendor - @diff=$$(git diff go.mod go.sum); \ +.PHONY: gomod-check +gomod-check: + @$(GO) mod tidy + @diff=$$(git diff go.sum); \ 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}"; \ exit 1; \ fi From d61ada41e1c05764c5e54368323513aee0d97dfd Mon Sep 17 00:00:00 2001 From: a1012112796 <1012112796@qq.com> Date: Mon, 17 Jan 2022 08:34:23 +0800 Subject: [PATCH 6/6] Revert "remove vendor from .gitattributes @silverwind" This reverts commit 4789e704cb7a2c80934e4a4cd31efb161e6c8666. --- .gitattributes | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitattributes b/.gitattributes index 17d4c3d8afd3..05dde22cccb4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,5 @@ * text=auto eol=lf +/vendor/** -text -eol linguist-vendored /public/vendor/** -text -eol linguist-vendored /templates/**/*.tmpl linguist-language=Handlebars /.eslintrc linguist-language=YAML