1
1
DIST := dist
2
2
DIST_DIRS := $(DIST ) /binaries $(DIST ) /release
3
3
IMPORT := code.gitea.io/gitea
4
- export GO111MODULE =off
4
+ export GO111MODULE =on
5
5
6
6
GO ?= go
7
7
SED_INPLACE := sed -i
66
66
67
67
LDFLAGS := $(LDFLAGS ) -X "main.MakeVersion=$(MAKE_VERSION ) " -X "main.Version=$(GITEA_VERSION ) " -X "main.Tags=$(TAGS ) "
68
68
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/) ) )
70
70
71
71
WEBPACK_SOURCES := $(shell find web_src/js web_src/less -type f)
72
72
WEBPACK_CONFIGS := webpack.config.js
@@ -95,7 +95,7 @@ FOMANTIC_DEST := public/fomantic/semantic.min.js public/fomantic/semantic.min.cs
95
95
FOMANTIC_DEST_DIR := public/fomantic
96
96
97
97
# 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
99
99
SWAGGER_SPEC := templates/swagger/v1_json.tmpl
100
100
SWAGGER_SPEC_S_TMPL := s|"basePath": *"/api/v1"|"basePath": "{{AppSubUrl}}/api/v1"|g
101
101
SWAGGER_SPEC_S_JSON := s|"basePath": *"{{AppSubUrl}}/api/v1"|"basePath": "/api/v1"|g
@@ -193,7 +193,11 @@ fmt:
193
193
194
194
.PHONY : vet
195
195
vet :
196
+ # Default vet
196
197
$(GO ) vet $(GO_PACKAGES )
198
+ # Custom vet
199
+ $(GO ) build -mod=vendor gitea.com/jolheiser/gitea-vet
200
+ $(GO ) vet -vettool=gitea-vet $(GO_PACKAGES )
197
201
198
202
.PHONY : $(TAGS_EVIDENCE )
199
203
$(TAGS_EVIDENCE ) :
@@ -264,7 +268,7 @@ fmt-check:
264
268
lint : lint-backend lint-frontend
265
269
266
270
.PHONY : lint-backend
267
- lint-backend : golangci-lint revive swagger-check swagger-validate test-vendor
271
+ lint-backend : golangci-lint revive vet swagger-check swagger-validate test-vendor
268
272
269
273
.PHONY : lint-frontend
270
274
lint-frontend : node_modules
@@ -273,7 +277,7 @@ lint-frontend: node_modules
273
277
274
278
.PHONY : test
275
279
test :
276
- GO111MODULE=on $(GO ) test $(GOTESTFLAGS ) -mod=vendor -tags=' sqlite sqlite_unlock_notify' $(GO_PACKAGES )
280
+ $(GO ) test $(GOTESTFLAGS ) -mod=vendor -tags=' sqlite sqlite_unlock_notify' $(GO_PACKAGES )
277
281
278
282
.PHONY : test-check
279
283
test-check :
@@ -289,22 +293,19 @@ test-check:
289
293
290
294
.PHONY : test\# %
291
295
test\#% :
292
- GO111MODULE=on $(GO ) test -mod=vendor -tags=' sqlite sqlite_unlock_notify' -run $* $(GO_PACKAGES )
296
+ $(GO ) test -mod=vendor -tags=' sqlite sqlite_unlock_notify' -run $( subst .,/, $* ) $(GO_PACKAGES )
293
297
294
298
.PHONY : coverage
295
299
coverage :
296
- @hash gocovmerge > /dev/null 2>&1 ; if [ $$ ? -ne 0 ]; then \
297
- $(GO ) get -u github.com/wadey/gocovmerge; \
298
- fi
299
- gocovmerge integration.coverage.out $(shell find . -type f -name "coverage.out") > coverage.all; \
300
+ GO111MODULE=on $(GO ) run -mod=vendor build/gocovmerge.go integration.coverage.out $(shell find . -type f -name "coverage.out") > coverage.all
300
301
301
302
.PHONY : unit-test-coverage
302
303
unit-test-coverage :
303
- 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
304
+ $(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
304
305
305
306
.PHONY : vendor
306
307
vendor :
307
- GO111MODULE=on $(GO ) mod tidy && GO111MODULE=on $(GO ) mod vendor
308
+ $(GO ) mod tidy && $(GO ) mod vendor
308
309
309
310
.PHONY : test-vendor
310
311
test-vendor : vendor
@@ -321,7 +322,7 @@ test-sqlite: integrations.sqlite.test
321
322
322
323
.PHONY : test-sqlite\# %
323
324
test-sqlite\#% : integrations.sqlite.test
324
- GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test -test.run $*
325
+ GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test -test.run $( subst .,/, $* )
325
326
326
327
.PHONY : test-sqlite-migration
327
328
test-sqlite-migration : migrations.sqlite.test
@@ -340,7 +341,7 @@ test-mysql: integrations.mysql.test generate-ini-mysql
340
341
341
342
.PHONY : test-mysql\# %
342
343
test-mysql\#% : integrations.mysql.test generate-ini-mysql
343
- GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./integrations.mysql.test -test.run $*
344
+ GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./integrations.mysql.test -test.run $( subst .,/, $* )
344
345
345
346
.PHONY : test-mysql-migration
346
347
test-mysql-migration : migrations.mysql.test generate-ini-mysql
@@ -359,7 +360,7 @@ test-mysql8: integrations.mysql8.test generate-ini-mysql8
359
360
360
361
.PHONY : test-mysql8\# %
361
362
test-mysql8\#% : integrations.mysql8.test generate-ini-mysql8
362
- GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql8.ini ./integrations.mysql8.test -test.run $*
363
+ GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql8.ini ./integrations.mysql8.test -test.run $( subst .,/, $* )
363
364
364
365
.PHONY : test-mysql8-migration
365
366
test-mysql8-migration : migrations.mysql8.test generate-ini-mysql8
@@ -379,7 +380,7 @@ test-pgsql: integrations.pgsql.test generate-ini-pgsql
379
380
380
381
.PHONY : test-pgsql\# %
381
382
test-pgsql\#% : integrations.pgsql.test generate-ini-pgsql
382
- GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/pgsql.ini ./integrations.pgsql.test -test.run $*
383
+ GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/pgsql.ini ./integrations.pgsql.test -test.run $( subst .,/, $* )
383
384
384
385
.PHONY : test-pgsql-migration
385
386
test-pgsql-migration : migrations.pgsql.test generate-ini-pgsql
@@ -398,7 +399,7 @@ test-mssql: integrations.mssql.test generate-ini-mssql
398
399
399
400
.PHONY : test-mssql\# %
400
401
test-mssql\#% : integrations.mssql.test generate-ini-mssql
401
- GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mssql.ini ./integrations.mssql.test -test.run $*
402
+ GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mssql.ini ./integrations.mssql.test -test.run $( subst .,/, $* )
402
403
403
404
.PHONY : test-mssql-migration
404
405
test-mssql-migration : migrations.mssql.test generate-ini-mssql
@@ -425,22 +426,22 @@ integration-test-coverage: integrations.cover.test generate-ini-mysql
425
426
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./integrations.cover.test -test.coverprofile=integration.coverage.out
426
427
427
428
integrations.mysql.test : git-check $(GO_SOURCES )
428
- GO111MODULE=on $(GO ) test $(GOTESTFLAGS ) -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.mysql.test
429
+ $(GO ) test $(GOTESTFLAGS ) -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.mysql.test
429
430
430
431
integrations.mysql8.test : git-check $(GO_SOURCES )
431
- GO111MODULE=on $(GO ) test $(GOTESTFLAGS ) -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.mysql8.test
432
+ $(GO ) test $(GOTESTFLAGS ) -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.mysql8.test
432
433
433
434
integrations.pgsql.test : git-check $(GO_SOURCES )
434
- GO111MODULE=on $(GO ) test $(GOTESTFLAGS ) -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.pgsql.test
435
+ $(GO ) test $(GOTESTFLAGS ) -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.pgsql.test
435
436
436
437
integrations.mssql.test : git-check $(GO_SOURCES )
437
- GO111MODULE=on $(GO ) test $(GOTESTFLAGS ) -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.mssql.test
438
+ $(GO ) test $(GOTESTFLAGS ) -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.mssql.test
438
439
439
440
integrations.sqlite.test : git-check $(GO_SOURCES )
440
- GO111MODULE=on $(GO ) test $(GOTESTFLAGS ) -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.sqlite.test -tags ' sqlite sqlite_unlock_notify'
441
+ $(GO ) test $(GOTESTFLAGS ) -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.sqlite.test -tags ' sqlite sqlite_unlock_notify'
441
442
442
443
integrations.cover.test : git-check $(GO_SOURCES )
443
- GO111MODULE=on $(GO ) test $(GOTESTFLAGS ) -mod=vendor -c code.gitea.io/gitea/integrations -coverpkg $(shell echo $(GO_PACKAGES ) | tr ' ' ',') -o integrations.cover.test
444
+ $(GO ) test $(GOTESTFLAGS ) -mod=vendor -c code.gitea.io/gitea/integrations -coverpkg $(shell echo $(GO_PACKAGES ) | tr ' ' ',') -o integrations.cover.test
444
445
445
446
.PHONY : migrations.mysql.test
446
447
migrations.mysql.test : $(GO_SOURCES )
@@ -480,10 +481,10 @@ backend: go-check generate $(EXECUTABLE)
480
481
481
482
.PHONY : generate
482
483
generate : $(TAGS_PREREQ )
483
- GO111MODULE=on $(GO ) generate -mod=vendor -tags ' $(TAGS)' $(GO_PACKAGES )
484
+ CC= GOOS= GOARCH= $(GO ) generate -mod=vendor -tags ' $(TAGS)' $(GO_PACKAGES )
484
485
485
486
$(EXECUTABLE ) : $(GO_SOURCES ) $(TAGS_PREREQ )
486
- GO111MODULE=on $(GO ) build -mod=vendor $(GOFLAGS ) $(EXTRA_GOFLAGS ) -tags ' $(TAGS)' -ldflags ' -s -w $(LDFLAGS)' -o $@
487
+ $(GO ) build -mod=vendor $(GOFLAGS ) $(EXTRA_GOFLAGS ) -tags ' $(TAGS)' -ldflags ' -s -w $(LDFLAGS)' -o $@
487
488
488
489
.PHONY : release
489
490
release : frontend generate release-windows release-linux release-darwin release-copy release-compress release-sources release-check
@@ -496,7 +497,7 @@ release-windows: | $(DIST_DIRS)
496
497
@hash xgo > /dev/null 2>&1 ; if [ $$ ? -ne 0 ]; then \
497
498
$(GO ) get -u src.techknowlogick.com/xgo; \
498
499
fi
499
- xgo -go $(XGO_VERSION ) -dest $(DIST ) /binaries -tags ' netgo osusergo $(TAGS)' -ldflags ' -linkmode external -extldflags "-static" $(LDFLAGS)' -targets ' windows/*' -out gitea-$(VERSION ) .
500
+ GO111MODULE=off xgo -go $(XGO_VERSION ) -dest $(DIST ) /binaries -tags ' netgo osusergo $(TAGS)' -ldflags ' -linkmode external -extldflags "-static" $(LDFLAGS)' -targets ' windows/*' -out gitea-$(VERSION ) .
500
501
ifeq ($(CI ) ,drone)
501
502
cp /build/* $(DIST)/binaries
502
503
endif
@@ -506,7 +507,7 @@ release-linux: | $(DIST_DIRS)
506
507
@hash xgo > /dev/null 2>&1 ; if [ $$ ? -ne 0 ]; then \
507
508
$(GO ) get -u src.techknowlogick.com/xgo; \
508
509
fi
509
- xgo -go $(XGO_VERSION ) -dest $(DIST ) /binaries -tags ' netgo osusergo $(TAGS)' -ldflags ' -linkmode external -extldflags "-static" $(LDFLAGS)' -targets ' linux/amd64,linux/386,linux/arm-5,linux/arm-6,linux/arm64,linux/mips64le,linux/mips,linux/mipsle' -out gitea-$(VERSION ) .
510
+ GO111MODULE=off xgo -go $(XGO_VERSION ) -dest $(DIST ) /binaries -tags ' netgo osusergo $(TAGS)' -ldflags ' -linkmode external -extldflags "-static" $(LDFLAGS)' -targets ' linux/amd64,linux/386,linux/arm-5,linux/arm-6,linux/arm64,linux/mips64le,linux/mips,linux/mipsle' -out gitea-$(VERSION ) .
510
511
ifeq ($(CI ) ,drone)
511
512
cp /build/* $(DIST)/binaries
512
513
endif
@@ -516,7 +517,7 @@ release-darwin: | $(DIST_DIRS)
516
517
@hash xgo > /dev/null 2>&1 ; if [ $$ ? -ne 0 ]; then \
517
518
$(GO ) get -u src.techknowlogick.com/xgo; \
518
519
fi
519
- xgo -go $(XGO_VERSION ) -dest $(DIST ) /binaries -tags ' netgo osusergo $(TAGS)' -ldflags ' $(LDFLAGS)' -targets ' darwin/*' -out gitea-$(VERSION ) .
520
+ GO111MODULE=off xgo -go $(XGO_VERSION ) -dest $(DIST ) /binaries -tags ' netgo osusergo $(TAGS)' -ldflags ' $(LDFLAGS)' -targets ' darwin/*' -out gitea-$(VERSION ) .
520
521
ifeq ($(CI ) ,drone)
521
522
cp /build/* $(DIST)/binaries
522
523
endif
@@ -532,7 +533,7 @@ release-check: | $(DIST_DIRS)
532
533
.PHONY : release-compress
533
534
release-compress : | $(DIST_DIRS )
534
535
@hash gxz > /dev/null 2>&1 ; if [ $$ ? -ne 0 ]; then \
535
- $(GO ) get -u github.com/ulikunitz/xz/cmd/gxz; \
536
+ GO111MODULE=off $(GO ) get -u github.com/ulikunitz/xz/cmd/gxz; \
536
537
fi
537
538
cd $(DIST ) /release/; for file in ` find . -type f -name " *" ` ; do echo " compressing $$ {file}" && gxz -k -9 $$ {file}; done ;
538
539
@@ -620,4 +621,4 @@ golangci-lint:
620
621
export BINARY=" golangci-lint" ; \
621
622
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(GOPATH ) /bin v1.24.0; \
622
623
fi
623
- env GO111MODULE=on golangci-lint run --timeout 5m
624
+ golangci-lint run --timeout 5m
0 commit comments