Skip to content

Commit 2a06d3a

Browse files
mrsdizzielunny
andauthored
Enable GO111MODULE=on globally in Makefile (#10939)
Now that our minimum required go version is 1.12 we can remove code that disables GO111MODULE globally and turn it on, so each command doesn't need it set specifically. Also fixes a small bug with make pr that didn't work because GO111MODULE=on wasn't set Co-authored-by: Lunny Xiao <[email protected]>
1 parent b264c30 commit 2a06d3a

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

Makefile

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
DIST := dist
22
DIST_DIRS := $(DIST)/binaries $(DIST)/release
33
IMPORT := code.gitea.io/gitea
4-
export GO111MODULE=off
4+
export GO111MODULE=on
55

66
GO ?= go
77
SED_INPLACE := sed -i
@@ -66,7 +66,7 @@ endif
6666

6767
LDFLAGS := $(LDFLAGS) -X "main.MakeVersion=$(MAKE_VERSION)" -X "main.Version=$(GITEA_VERSION)" -X "main.Tags=$(TAGS)"
6868

69-
GO_PACKAGES ?= $(filter-out code.gitea.io/gitea/integrations/migration-test,$(filter-out code.gitea.io/gitea/integrations,$(shell GO111MODULE=on $(GO) list -mod=vendor ./... | grep -v /vendor/)))
69+
GO_PACKAGES ?= $(filter-out code.gitea.io/gitea/integrations/migration-test,$(filter-out code.gitea.io/gitea/integrations,$(shell $(GO) list -mod=vendor ./... | grep -v /vendor/)))
7070

7171
WEBPACK_SOURCES := $(shell find web_src/js web_src/less -type f)
7272
WEBPACK_CONFIGS := webpack.config.js
@@ -95,7 +95,7 @@ FOMANTIC_DEST := public/fomantic/semantic.min.js public/fomantic/semantic.min.cs
9595
FOMANTIC_DEST_DIR := public/fomantic
9696

9797
#To update swagger use: GO111MODULE=on go get -u github.com/go-swagger/go-swagger/cmd/[email protected]
98-
SWAGGER := GO111MODULE=on $(GO) run -mod=vendor github.com/go-swagger/go-swagger/cmd/swagger
98+
SWAGGER := $(GO) run -mod=vendor github.com/go-swagger/go-swagger/cmd/swagger
9999
SWAGGER_SPEC := templates/swagger/v1_json.tmpl
100100
SWAGGER_SPEC_S_TMPL := s|"basePath": *"/api/v1"|"basePath": "{{AppSubUrl}}/api/v1"|g
101101
SWAGGER_SPEC_S_JSON := s|"basePath": *"{{AppSubUrl}}/api/v1"|"basePath": "/api/v1"|g
@@ -273,7 +273,7 @@ lint-frontend: node_modules
273273

274274
.PHONY: test
275275
test:
276-
GO111MODULE=on $(GO) test $(GOTESTFLAGS) -mod=vendor -tags='sqlite sqlite_unlock_notify' $(GO_PACKAGES)
276+
$(GO) test $(GOTESTFLAGS) -mod=vendor -tags='sqlite sqlite_unlock_notify' $(GO_PACKAGES)
277277

278278
.PHONY: test-check
279279
test-check:
@@ -289,19 +289,19 @@ test-check:
289289

290290
.PHONY: test\#%
291291
test\#%:
292-
GO111MODULE=on $(GO) test -mod=vendor -tags='sqlite sqlite_unlock_notify' -run $* $(GO_PACKAGES)
292+
$(GO) test -mod=vendor -tags='sqlite sqlite_unlock_notify' -run $* $(GO_PACKAGES)
293293

294294
.PHONY: coverage
295295
coverage:
296296
GO111MODULE=on $(GO) run -mod=vendor build/gocovmerge.go integration.coverage.out $(shell find . -type f -name "coverage.out") > coverage.all
297297

298298
.PHONY: unit-test-coverage
299299
unit-test-coverage:
300-
GO111MODULE=on $(GO) test $(GOTESTFLAGS) -mod=vendor -tags='sqlite sqlite_unlock_notify' -cover -coverprofile coverage.out $(GO_PACKAGES) && echo "\n==>\033[32m Ok\033[m\n" || exit 1
300+
$(GO) test $(GOTESTFLAGS) -mod=vendor -tags='sqlite sqlite_unlock_notify' -cover -coverprofile coverage.out $(GO_PACKAGES) && echo "\n==>\033[32m Ok\033[m\n" || exit 1
301301

302302
.PHONY: vendor
303303
vendor:
304-
GO111MODULE=on $(GO) mod tidy && GO111MODULE=on $(GO) mod vendor
304+
$(GO) mod tidy && $(GO) mod vendor
305305

306306
.PHONY: test-vendor
307307
test-vendor: vendor
@@ -422,22 +422,22 @@ integration-test-coverage: integrations.cover.test generate-ini-mysql
422422
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./integrations.cover.test -test.coverprofile=integration.coverage.out
423423

424424
integrations.mysql.test: git-check $(GO_SOURCES)
425-
GO111MODULE=on $(GO) test $(GOTESTFLAGS) -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.mysql.test
425+
$(GO) test $(GOTESTFLAGS) -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.mysql.test
426426

427427
integrations.mysql8.test: git-check $(GO_SOURCES)
428-
GO111MODULE=on $(GO) test $(GOTESTFLAGS) -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.mysql8.test
428+
$(GO) test $(GOTESTFLAGS) -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.mysql8.test
429429

430430
integrations.pgsql.test: git-check $(GO_SOURCES)
431-
GO111MODULE=on $(GO) test $(GOTESTFLAGS) -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.pgsql.test
431+
$(GO) test $(GOTESTFLAGS) -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.pgsql.test
432432

433433
integrations.mssql.test: git-check $(GO_SOURCES)
434-
GO111MODULE=on $(GO) test $(GOTESTFLAGS) -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.mssql.test
434+
$(GO) test $(GOTESTFLAGS) -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.mssql.test
435435

436436
integrations.sqlite.test: git-check $(GO_SOURCES)
437-
GO111MODULE=on $(GO) test $(GOTESTFLAGS) -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.sqlite.test -tags 'sqlite sqlite_unlock_notify'
437+
$(GO) test $(GOTESTFLAGS) -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.sqlite.test -tags 'sqlite sqlite_unlock_notify'
438438

439439
integrations.cover.test: git-check $(GO_SOURCES)
440-
GO111MODULE=on $(GO) test $(GOTESTFLAGS) -mod=vendor -c code.gitea.io/gitea/integrations -coverpkg $(shell echo $(GO_PACKAGES) | tr ' ' ',') -o integrations.cover.test
440+
$(GO) test $(GOTESTFLAGS) -mod=vendor -c code.gitea.io/gitea/integrations -coverpkg $(shell echo $(GO_PACKAGES) | tr ' ' ',') -o integrations.cover.test
441441

442442
.PHONY: migrations.mysql.test
443443
migrations.mysql.test: $(GO_SOURCES)
@@ -477,10 +477,10 @@ backend: go-check generate $(EXECUTABLE)
477477

478478
.PHONY: generate
479479
generate: $(TAGS_PREREQ)
480-
GO111MODULE=on $(GO) generate -mod=vendor -tags '$(TAGS)' $(GO_PACKAGES)
480+
$(GO) generate -mod=vendor -tags '$(TAGS)' $(GO_PACKAGES)
481481

482482
$(EXECUTABLE): $(GO_SOURCES) $(TAGS_PREREQ)
483-
GO111MODULE=on $(GO) build -mod=vendor $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@
483+
$(GO) build -mod=vendor $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@
484484

485485
.PHONY: release
486486
release: frontend generate release-windows release-linux release-darwin release-copy release-compress release-sources release-check
@@ -617,4 +617,4 @@ golangci-lint:
617617
export BINARY="golangci-lint"; \
618618
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(GOPATH)/bin v1.24.0; \
619619
fi
620-
env GO111MODULE=on golangci-lint run --timeout 5m
620+
golangci-lint run --timeout 5m

0 commit comments

Comments
 (0)