diff --git a/Makefile b/Makefile index bd6485c9..a0168911 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ all: agent credential-helper download-binaries ## Build everything agent: ## Build the agent @echo "Building Portainer agent..." - @CGO_ENABLED=0 GOOS=$(PLATFORM) GOARCH=$(ARCH) go build -trimpath --installsuffix cgo --ldflags "-s" -o dist/$(agent) cmd/agent/main.go + @GOOS=$(PLATFORM) GOARCH=$(ARCH) go build -race -trimpath --installsuffix cgo --ldflags "-s" -o dist/$(agent) cmd/agent/main.go credential-helper: ## Build the credential helper (used by edge private registries) @echo "Building Portainer credential-helper..." diff --git a/dev-scripts/compile.sh b/dev-scripts/compile.sh index d910e607..b8c52c17 100644 --- a/dev-scripts/compile.sh +++ b/dev-scripts/compile.sh @@ -21,14 +21,14 @@ function compile_agent() { cd cmd/agent || exit 1 - local cmd=(go build -trimpath --installsuffix cgo) + local cmd=(go build -race -trimpath --installsuffix cgo) ldflags="-s" if [[ -n "$AGENT_VERSION" ]]; then ldflags="$ldflags -X 'github.com/portainer/agent.Version=${AGENT_VERSION}'" fi - GOOS="linux" GOARCH="$(go env GOARCH)" CGO_ENABLED=0 "${cmd[@]}" --ldflags "$ldflags" + GOOS="linux" GOARCH="$(go env GOARCH)" "${cmd[@]}" --ldflags "$ldflags" rc=$? if [[ $rc != 0 ]]; then exit $rc; fi diff --git a/release.sh b/release.sh index 1d78739c..42b40e14 100755 --- a/release.sh +++ b/release.sh @@ -37,7 +37,7 @@ function build_archive() { function build_binary() { platform=$1 arch=$2 - GOOS="${platform}" GOARCH="${arch}" CGO_ENABLED=0 go build -a -trimpath --installsuffix cgo --ldflags '-s' "${MAIN}" + GOOS="${platform}" GOARCH="${arch}" go build -race -a -trimpath --installsuffix cgo --ldflags '-s' "${MAIN}" mv main "dist/agent" }