Skip to content

Commit

Permalink
Revert "chore: Update CGO_ENABLED flag in Makefile"
Browse files Browse the repository at this point in the history
This reverts commit 233b0cd.
  • Loading branch information
Ehco1996 committed Feb 4, 2024
1 parent 233b0cd commit 77a1a71
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ FILES := $(shell find . -name "*.go" -type f)
FAIL_ON_STDOUT := awk '{ print } END { if (NR > 0) { exit 1 } }'


# -w -s: You will get the smallest binaries if you compile with -ldflags '-w -s'. The -w turns off DWARF debugging information
# -w -s 参数的解释:You will get the smallest binaries if you compile with -ldflags '-w -s'. The -w turns off DWARF debugging information
# for more information, please refer to https://stackoverflow.com/questions/22267189/what-does-the-w-flag-mean-when-passed-in-via-the-ldflags-option-to-the-go-comman
# we need CGO_ENABLED=1 because we import the node_exporter ,and we need install `glibc-source,libc6` to make it work
GOBUILD=CGO_ENABLED=1 go build -trimpath -ldflags="-w -s -X ${PACKAGE}.GitBranch=${BRANCH} -X ${PACKAGE}.GitRevision=${REVISION} -X ${PACKAGE}.BuildTime=${BUILDTIME}"
# TODO check if node_exporter collector with CGO_ENABLED=0 is enough
GOBUILD=CGO_ENABLED=0 go build -trimpath -ldflags="-w -s -X ${PACKAGE}.GitBranch=${BRANCH} -X ${PACKAGE}.GitRevision=${REVISION} -X ${PACKAGE}.BuildTime=${BUILDTIME}"

tools:
@echo "run setup tools"
Expand Down

0 comments on commit 77a1a71

Please sign in to comment.