Add -race option to tests
This commit is contained in:
parent
eb1cc37456
commit
899a863131
1 changed files with 6 additions and 6 deletions
12
Makefile
12
Makefile
|
|
@ -2,13 +2,13 @@ COMMIT := $(shell if [ -d .git ]; then git rev-parse HEAD; else echo "unknown";
|
||||||
SHORTCOMMIT := $(shell echo $(COMMIT) | head -c 7)
|
SHORTCOMMIT := $(shell echo $(COMMIT) | head -c 7)
|
||||||
BRANCH := $(shell if [ -d .git ]; then git rev-parse --abbrev-ref HEAD; else echo "master"; fi)
|
BRANCH := $(shell if [ -d .git ]; then git rev-parse --abbrev-ref HEAD; else echo "master"; fi)
|
||||||
BUILD := $(shell date -u "+%Y-%m-%dT%H:%M:%SZ")
|
BUILD := $(shell date -u "+%Y-%m-%dT%H:%M:%SZ")
|
||||||
OSARCH := $(shell if [ "${GOOS}" -a "${GOARCH}" ]; then echo "-${GOOS}-${GOARCH}"; else echo ""; fi)
|
BINSUFFIX := $(shell if [ "${GOOS}" -a "${GOARCH}" ]; then echo "-${GOOS}-${GOARCH}"; else echo ""; fi)
|
||||||
|
|
||||||
all: build
|
all: build
|
||||||
|
|
||||||
## build: Build core (default)
|
## build: Build core (default)
|
||||||
build:
|
build:
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=${OSARCH} go build -o core${OSARCH}
|
CGO_ENABLED=${CGO_ENABLED} GOOS=${GOOS} GOARCH=${GOARCH} go build -o core${BINSUFFIX}
|
||||||
|
|
||||||
## swagger: Update swagger API documentation (requires github.com/swaggo/swag)
|
## swagger: Update swagger API documentation (requires github.com/swaggo/swag)
|
||||||
swagger:
|
swagger:
|
||||||
|
|
@ -20,7 +20,7 @@ gqlgen:
|
||||||
|
|
||||||
## test: Run all tests
|
## test: Run all tests
|
||||||
test:
|
test:
|
||||||
go test -coverprofile=/dev/null ./...
|
go test -race -coverprofile=/dev/null -v ./...
|
||||||
|
|
||||||
## vet: Analyze code for potential errors
|
## vet: Analyze code for potential errors
|
||||||
vet:
|
vet:
|
||||||
|
|
@ -54,11 +54,11 @@ lint:
|
||||||
|
|
||||||
## import: Build import binary
|
## import: Build import binary
|
||||||
import:
|
import:
|
||||||
cd app/import && CGO_ENABLED=0 GOOS=linux GOARCH=${OSARCH} go build -o ../../import -ldflags="-s -w"
|
cd app/import && CGO_ENABLED=${CGO_ENABLED} GOOS=${GOOS} GOARCH=${GOARCH} go build -o ../../import -ldflags="-s -w"
|
||||||
|
|
||||||
## coverage: Generate code coverage analysis
|
## coverage: Generate code coverage analysis
|
||||||
coverage:
|
coverage:
|
||||||
go test -coverprofile test/cover.out ./...
|
go test -race -coverprofile test/cover.out ./...
|
||||||
go tool cover -html=test/cover.out -o test/cover.html
|
go tool cover -html=test/cover.out -o test/cover.html
|
||||||
|
|
||||||
## commit: Prepare code for commit (vet, fmt, test)
|
## commit: Prepare code for commit (vet, fmt, test)
|
||||||
|
|
@ -67,7 +67,7 @@ commit: vet fmt lint test build
|
||||||
|
|
||||||
## release: Build a release binary of core
|
## release: Build a release binary of core
|
||||||
release:
|
release:
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=${OSARCH} go build -o core -ldflags="-s -w -X github.com/datarhei/core/app.Commit=$(COMMIT) -X github.com/datarhei/core/app.Branch=$(BRANCH) -X github.com/datarhei/core/app.Build=$(BUILD)"
|
CGO_ENABLED=${CGO_ENABLED} GOOS=${GOOS} GOARCH=${GOARCH} go build -o core -ldflags="-s -w -X github.com/datarhei/core/app.Commit=$(COMMIT) -X github.com/datarhei/core/app.Branch=$(BRANCH) -X github.com/datarhei/core/app.Build=$(BUILD)"
|
||||||
|
|
||||||
## docker: Build standard Docker image
|
## docker: Build standard Docker image
|
||||||
docker:
|
docker:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue