]> ruderich.org/simon Gitweb - safcm/safcm.git/commitdiff
Makefile: set -race via GOFLAGS= variable
authorSimon Ruderich <simon@ruderich.org>
Sat, 17 Apr 2021 07:43:27 +0000 (09:43 +0200)
committerSimon Ruderich <simon@ruderich.org>
Sat, 17 Apr 2021 12:53:37 +0000 (14:53 +0200)
Makefile

index 152ec8a21927a82c6057a686ca84fc123f70bc3a..f4cc011e6aa6abdab01f603e4d50d3193e54b8a0 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,6 +2,8 @@ LDFLAGS = '\
     -X "main.versionGit=$(shell git describe --long --tags --dirty --always)" \
     -X "main.versionGo=$(shell go version)" \
 '
+# Build with `make GOFLAGS=` if -race is not supported
+GOFLAGS=-race
 
 
 all: safcm
@@ -9,13 +11,13 @@ all: safcm
 safcm:
        go fmt ./...
        cd cmd/safcm-remote && ./build.sh
-       go build -ldflags $(LDFLAGS) -race ruderich.org/simon/safcm/cmd/safcm
+       go build $(GOFLAGS) -ldflags $(LDFLAGS) ruderich.org/simon/safcm/cmd/safcm
        @# For proper permissions after initial clone with a strict umask
        cd cmd/safcm/testdata/project && ../../../../safcm fixperms 2> /dev/null
 
 test:
        go vet ./...
-       go test -race ./...
+       go test $(GOFLAGS) ./...
 
 clean:
        rm -rf remote/helpers/