Do not enable -race for GOARCH=386

This commit is contained in:
Jakub Warczarek 2020-07-03 19:20:55 +02:00
parent a9d023d567
commit eb06e027f0
1 changed files with 14 additions and 8 deletions

View File

@ -50,6 +50,12 @@ ifneq ($(tag),)
LDFLAGS += -X main.version=$(version) LDFLAGS += -X main.version=$(version)
endif endif
# Go built-in race detector works only for 64 bits architectures.
ifneq ($(GOARCH), 386)
race_detector := -race
endif
GOFILES ?= $(shell git ls-files '*.go') GOFILES ?= $(shell git ls-files '*.go')
GOFMT ?= $(shell gofmt -l -s $(filter-out plugins/parsers/influx/machine.go, $(GOFILES))) GOFMT ?= $(shell gofmt -l -s $(filter-out plugins/parsers/influx/machine.go, $(GOFILES)))
@ -89,7 +95,7 @@ telegraf:
.PHONY: test .PHONY: test
test: test:
go test -race -short ./... go test -short $(race_detector) ./...
.PHONY: fmt .PHONY: fmt
fmt: fmt:
@ -107,12 +113,12 @@ fmtcheck:
.PHONY: test-windows .PHONY: test-windows
test-windows: test-windows:
go test -race -short ./plugins/inputs/ping/... go test -short $(race_detector) ./plugins/inputs/ping/...
go test -race -short ./plugins/inputs/win_perf_counters/... go test -short $(race_detector) ./plugins/inputs/win_perf_counters/...
go test -race -short ./plugins/inputs/win_services/... go test -short $(race_detector) ./plugins/inputs/win_services/...
go test -race -short ./plugins/inputs/procstat/... go test -short $(race_detector) ./plugins/inputs/procstat/...
go test -race -short ./plugins/inputs/ntpq/... go test -short $(race_detector) ./plugins/inputs/ntpq/...
go test -race -short ./plugins/processors/port_name/... go test -short $(race_detector) ./plugins/processors/port_name/...
.PHONY: vet .PHONY: vet
vet: vet:
@ -139,7 +145,7 @@ check: fmtcheck vet
.PHONY: test-all .PHONY: test-all
test-all: fmtcheck vet test-all: fmtcheck vet
go test -race ./... go test $(race_detector) ./...
.PHONY: check-deps .PHONY: check-deps
check-deps: check-deps: