From 1ccb6ddedec02bc040522160ffca2feabb4f2fca Mon Sep 17 00:00:00 2001 From: Jonathan Miller Date: Sat, 16 May 2026 08:26:26 -0500 Subject: [PATCH] fix: run go commands from src/ directory instead of using ./src/... The go.work indirection doesn't fully resolve modules when running from root. Fix by cd'ing into src/ for all go commands: - go build: cd src && go build -o ../gitea - go generate: cd src && go generate ./... - go get: cd src && go get -u ./... - govulncheck: cd src && govulncheck ./... - GO_TEST_PACKAGES: cd src && go list ./... Co-Authored-By: Claude Opus 4.6 (1M context) --- Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index fca7d47594..848b9165d5 100644 --- a/Makefile +++ b/Makefile @@ -110,7 +110,7 @@ LDFLAGS := $(LDFLAGS) -X "main.Version=$(GITEA_VERSION)" -X "main.Tags=$(TAGS)" LINUX_ARCHS ?= linux/amd64,linux/386,linux/arm-5,linux/arm-6,linux/arm64,linux/riscv64 -GO_TEST_PACKAGES ?= $(filter-out $(shell $(GO) list code.gitea.io/gitea/models/migrations/...) code.gitea.io/gitea/tests/integration/migration-test code.gitea.io/gitea/tests code.gitea.io/gitea/tests/integration,$(shell $(GO) list ./src/... | grep -v /vendor/)) +GO_TEST_PACKAGES ?= $(filter-out $(shell cd src && $(GO) list code.gitea.io/gitea/models/migrations/...) code.gitea.io/gitea/tests/integration/migration-test code.gitea.io/gitea/tests code.gitea.io/gitea/tests/integration,$(shell cd src && $(GO) list ./... | grep -v /vendor/)) MIGRATE_TEST_PACKAGES ?= $(shell $(GO) list code.gitea.io/gitea/models/migrations/...) FRONTEND_SOURCES := $(shell find web_src/js web_src/css -type f) @@ -501,17 +501,17 @@ generate-backend: $(TAGS_PREREQ) generate-go .PHONY: generate-go generate-go: $(TAGS_PREREQ) @echo "Running go generate..." - @CC= GOOS= GOARCH= CGO_ENABLED=0 $(GO) generate -tags '$(TAGS)' ./src/... + @cd src && CC= GOOS= GOARCH= CGO_ENABLED=0 $(GO) generate -tags '$(TAGS)' ./... .PHONY: security-check security-check: - GOEXPERIMENT= go run $(GOVULNCHECK_PACKAGE) -show color ./src/... || true + cd src && GOEXPERIMENT= go run $(GOVULNCHECK_PACKAGE) -show color ./... || true $(EXECUTABLE): $(GO_SOURCES) $(TAGS_PREREQ) ifneq ($(and $(STATIC),$(findstring pam,$(TAGS))),) $(error pam support set via TAGS does not support static builds) endif - CGO_ENABLED="$(CGO_ENABLED)" CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(EXTLDFLAGS) $(LDFLAGS)' -o $@ ./src + cd src && CGO_ENABLED="$(CGO_ENABLED)" CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(EXTLDFLAGS) $(LDFLAGS)' -o ../$@ .PHONY: release release: frontend generate release-windows release-linux release-darwin release-freebsd release-copy release-compress vendor release-sources release-check @@ -599,7 +599,7 @@ update: update-go update-js update-py ## update dependencies .PHONY: update-go update-go: ## update go dependencies - $(GO) get -u ./src/... + cd src && $(GO) get -u ./... $(MAKE) tidy .PHONY: update-js