Sfoglia il codice sorgente

Add -mod=vendor in Makefile

Frédéric Guillot 7 anni fa
parent
commit
362fc5c2ff
1 ha cambiato i file con 9 aggiunte e 7 eliminazioni
  1. 9 7
      Makefile

+ 9 - 7
Makefile

@@ -5,6 +5,8 @@ LD_FLAGS := "-s -w -X 'miniflux.app/version.Version=$(VERSION)' -X 'miniflux.app
 PKG_LIST := $(shell go list ./... | grep -v /vendor/)
 DB_URL := postgres://postgres:postgres@localhost/miniflux_test?sslmode=disable
 
+export GO111MODULE=on
+
 .PHONY: generate
 .PHONY: miniflux
 .PHONY: linux-amd64
@@ -19,7 +21,7 @@ DB_URL := postgres://postgres:postgres@localhost/miniflux_test?sslmode=disable
 .PHONY: build run clean test lint integration-test clean-integration-test
 
 generate:
-	@ go generate
+	@ go generate -mod=vendor
 
 miniflux: generate
 	@ go build -mod=vendor -ldflags=$(LD_FLAGS) -o $(APP) main.go
@@ -54,13 +56,13 @@ windows-amd64: generate
 build: linux-amd64 linux-armv8 linux-armv7 linux-armv6 linux-armv5 darwin-amd64 freebsd-amd64 openbsd-amd64 windows-amd64
 
 run: generate
-	@ go run main.go -debug
+	@ go run -mod=vendor main.go -debug
 
 clean:
 	@ rm -f $(APP)-* $(APP)
 
 test:
-	go test -cover -race -count=1 ./...
+	go test -mod=vendor -cover -race -count=1 ./...
 
 lint:
 	@ golint -set_exit_status ${PKG_LIST}
@@ -68,12 +70,12 @@ lint:
 integration-test:
 	psql -U postgres -c 'drop database if exists miniflux_test;'
 	psql -U postgres -c 'create database miniflux_test;'
-	DATABASE_URL=$(DB_URL) go run main.go -migrate
-	DATABASE_URL=$(DB_URL) ADMIN_USERNAME=admin ADMIN_PASSWORD=test123 go run main.go -create-admin
-	go build -o miniflux-test main.go
+	DATABASE_URL=$(DB_URL) go run -mod=vendor main.go -migrate
+	DATABASE_URL=$(DB_URL) ADMIN_USERNAME=admin ADMIN_PASSWORD=test123 go run -mod=vendor main.go -create-admin
+	go build -mod=vendor -o miniflux-test main.go
 	DATABASE_URL=$(DB_URL) ./miniflux-test -debug >/tmp/miniflux.log 2>&1 & echo "$$!" > "/tmp/miniflux.pid"
 	while ! echo exit | nc localhost 8080; do sleep 1; done >/dev/null
-	go test -v -tags=integration -count=1 miniflux.app/tests || cat /tmp/miniflux.log
+	go test -mod=vendor -v -tags=integration -count=1 miniflux.app/tests || cat /tmp/miniflux.log
 
 clean-integration-test:
 	@ kill -9 `cat /tmp/miniflux.pid`