Skip to content

Commit

Permalink
build: enable race-detector in DEBUG=1 builds.
Browse files Browse the repository at this point in the history
When building with DEBUG=1, also use the '-race' golang build
flag unless NORACE=1 is also set.

Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
  • Loading branch information
klihub authored and askervin committed Nov 12, 2024
1 parent 5d7df10 commit c003258
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ export IMAGE_PATH
# Determine binary version and buildid.
BUILD_VERSION ?= $(shell scripts/build/get-buildid --version --shell=no)
BUILD_BUILDID ?= $(shell scripts/build/get-buildid --buildid --shell=no)
BUILD_FLAGS ?=

GO_CMD := go
GO_BUILD := $(GO_CMD) build
GO_BUILD = $(GO_CMD) build $(BUILD_FLAGS)
GO_INSTALL := $(GO_CMD) install
GO_TEST := $(GO_CMD) test
GO_LINT := golint -set_exit_status
Expand Down Expand Up @@ -105,6 +106,9 @@ LDFLAGS = \
ifeq ($(DEBUG),1)
GCFLAGS ?= -gcflags "all=-N -l"
DOCKER_BUILD_DEBUG := --build-arg DEBUG=1
ifneq ($(NORACE),1)
BUILD_FLAGS += -race
endif
endif

# Documentation-related variables
Expand Down

0 comments on commit c003258

Please sign in to comment.