mirror of
https://github.com/datarhei/core.git
synced 2025-12-24 13:07:56 +08:00
Add -race option to tests
This commit is contained in:
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)
|
||||
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")
|
||||
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
|
||||
|
||||
## build: Build core (default)
|
||||
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:
|
||||
@@ -20,7 +20,7 @@ gqlgen:
|
||||
|
||||
## test: Run all tests
|
||||
test:
|
||||
go test -coverprofile=/dev/null ./...
|
||||
go test -race -coverprofile=/dev/null -v ./...
|
||||
|
||||
## vet: Analyze code for potential errors
|
||||
vet:
|
||||
@@ -54,11 +54,11 @@ lint:
|
||||
|
||||
## import: Build import binary
|
||||
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:
|
||||
go test -coverprofile test/cover.out ./...
|
||||
go test -race -coverprofile test/cover.out ./...
|
||||
go tool cover -html=test/cover.out -o test/cover.html
|
||||
|
||||
## 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:
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user