Fix makefile vendor problem (#533)

Replace #532

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Reviewed-on: https://gitea.com/gitea/tea/pulls/533
Reviewed-by: John Olheiser <john+gitea@jolheiser.com>
Reviewed-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
Lunny Xiao 2023-02-09 11:05:39 +08:00 committed by John Olheiser
parent faa9858a7e
commit 1a6d9b343a
2 changed files with 12 additions and 19 deletions

View File

@ -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

View File

@ -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