From 1a6d9b343abc5c96226c38749008658efc426bc9 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Thu, 9 Feb 2023 11:05:39 +0800 Subject: [PATCH] Fix makefile vendor problem (#533) Replace #532 Co-authored-by: techknowlogick Reviewed-on: https://gitea.com/gitea/tea/pulls/533 Reviewed-by: John Olheiser Reviewed-by: techknowlogick Co-authored-by: Lunny Xiao Co-committed-by: Lunny Xiao --- .drone.yml | 7 ------- Makefile | 24 ++++++++++++------------ 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/.drone.yml b/.drone.yml index 60d4eb8..1298658 100644 --- a/.drone.yml +++ b/.drone.yml @@ -7,13 +7,6 @@ platform: arch: amd64 steps: -- name: vendor - pull: always - image: golang:1.20 - environment: - GOPROXY: https://goproxy.io # proxy.golang.org is blocked in China, this proxy is not - commands: - - make vendor # use vendor folder as cache - name: build pull: always diff --git a/Makefile b/Makefile index f616587..69960fb 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ SHASUM ?= shasum -a 256 export PATH := $($(GO) env GOPATH)/bin:$(PATH) -GOFILES := $(shell find . -name "*.go" -type f ! -path "./vendor/*" ! -path "*/bindata.go") +GOFILES := $(shell find . -name "*.go" -type f ! -path "*/bindata.go") GOFMT ?= gofmt -s ifneq ($(DRONE_TAG),) @@ -28,9 +28,9 @@ SDK ?= $(shell $(GO) list -f '{{.Version}}' -m code.gitea.io/sdk/gitea) LDFLAGS := -X "main.Version=$(TEA_VERSION)" -X "main.Tags=$(TAGS)" -X "main.SDK=$(SDK)" -s -w # override to allow passing additional goflags via make CLI -override GOFLAGS := $(GOFLAGS) -mod=vendor -tags '$(TAGS)' -ldflags '$(LDFLAGS)' +override GOFLAGS := $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -PACKAGES ?= $(shell $(GO) list ./... | grep -v /vendor/) +PACKAGES ?= $(shell $(GO) list ./...) SOURCES ?= $(shell find . -name "*.go" -type f) # OS specific vars. @@ -48,7 +48,7 @@ all: build .PHONY: clean clean: - $(GO) clean -mod=vendor -i ./... + $(GO) clean -i ./... rm -rf $(EXECUTABLE) $(DIST) .PHONY: fmt @@ -58,14 +58,14 @@ fmt: .PHONY: vet vet: # Default vet - $(GO) vet -mod=vendor $(PACKAGES) + $(GO) vet $(PACKAGES) # Custom vet - $(GO) build -mod=vendor code.gitea.io/gitea-vet + $(GO) build code.gitea.io/gitea-vet $(GO) vet -vettool=gitea-vet $(PACKAGES) .PHONY: lint lint: install-lint-tools - revive -config .revive.toml -exclude=./vendor/... ./... || exit 1 + revive -config .revive.toml ./... || exit 1 .PHONY: misspell-check misspell-check: install-lint-tools @@ -87,15 +87,15 @@ fmt-check: .PHONY: test test: - $(GO) test -mod=vendor -tags='sqlite sqlite_unlock_notify' $(PACKAGES) + $(GO) test -tags='sqlite sqlite_unlock_notify' $(PACKAGES) .PHONY: unit-test-coverage unit-test-coverage: - $(GO) test -mod=vendor -tags='sqlite sqlite_unlock_notify' -cover -coverprofile coverage.out $(PACKAGES) && echo "\n==>\033[32m Ok\033[m\n" || exit 1 + $(GO) test -tags='sqlite sqlite_unlock_notify' -cover -coverprofile coverage.out $(PACKAGES) && echo "\n==>\033[32m Ok\033[m\n" || exit 1 -.PHONY: vendor -vendor: - $(GO) mod tidy && $(GO) mod vendor +.PHONY: tidy +tidy: + $(GO) mod tidy .PHONY: check check: test