From f145617b0f6fb17f00bc9120e201d6ca8d5f221b Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Wed, 22 May 2024 07:17:59 +0200 Subject: [PATCH] fix(build): generate does not need gomock * the file generated to by gomock is already in the sources * add generate-gomock to help with rebuilding the files Fixes: https://codeberg.org/forgejo/forgejo/issues/3861 --- Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 72757da883..18999a6069 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,7 @@ GO_LICENSES_PACKAGE ?= github.com/google/go-licenses@v1.6.0 # renovate: datasour GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@v1 # renovate: datasource=go ACTIONLINT_PACKAGE ?= github.com/rhysd/actionlint/cmd/actionlint@v1.6.27 # renovate: datasource=go DEADCODE_PACKAGE ?= golang.org/x/tools/internal/cmd/deadcode@v0.14.0 # renovate: datasource=go -GOMOCK_PACKAGE ?= go.uber.org/mock/mockgen@latest +GOMOCK_PACKAGE ?= go.uber.org/mock/mockgen@v0.4.0 # renovate: datasource=go DOCKER_IMAGE ?= gitea/gitea DOCKER_TAG ?= latest @@ -260,6 +260,7 @@ help: @echo " - generate-license update license files" @echo " - generate-gitignore update gitignore files" @echo " - generate-manpage generate manpage" + @echo " - generate-gomock generate gomock files" @echo " - generate-forgejo-api generate the forgejo API from spec" @echo " - forgejo-api-validate check if the forgejo API matches the specs" @echo " - generate-swagger generate the swagger spec from code comments" @@ -784,7 +785,6 @@ generate-backend: $(TAGS_PREREQ) generate-go generate-go: $(TAGS_PREREQ) @echo "Running go generate..." @CC= GOOS= GOARCH= CGO_ENABLED=0 $(GO) generate -tags '$(TAGS)' ./... - $(GO) run $(GOMOCK_PACKAGE) -package mock -destination ./modules/queue/mock/redisuniversalclient.go github.com/redis/go-redis/v9 UniversalClient .PHONY: merge-locales merge-locales: @@ -971,6 +971,10 @@ generate-license: generate-gitignore: $(GO) run build/generate-gitignores.go +.PHONY: generate-gomock +generate-gomock: + $(GO) run $(GOMOCK_PACKAGE) -package mock -destination ./modules/queue/mock/redisuniversalclient.go github.com/redis/go-redis/v9 UniversalClient + .PHONY: generate-images generate-images: | node_modules npm install --no-save fabric@6.0.0-beta20 imagemin-zopfli@7