summaryrefslogtreecommitdiff
path: root/hack/lib/golang.sh
diff options
context:
space:
mode:
authorKubeEdge Bot <48982446+kubeedge-bot@users.noreply.github.com>2020-09-12 16:32:26 +0800
committerGitHub <noreply@github.com>2020-09-12 16:32:26 +0800
commit4af0771a015081843287991bd3ac54108bc8ba85 (patch)
tree40ff0e4b74f766295b13e33cf6b69de04974f9c2 /hack/lib/golang.sh
parentMerge pull request #2149 from daixiang0/aarrch (diff)
parentAdd the build option to make the binaries debuggable (diff)
downloadkubeedge-4af0771a015081843287991bd3ac54108bc8ba85.tar.gz
Merge pull request #2093 from chendave/buildoption
Add the build option to make the binaries debuggable
Diffstat (limited to 'hack/lib/golang.sh')
-rw-r--r--hack/lib/golang.sh8
1 files changed, 5 insertions, 3 deletions
diff --git a/hack/lib/golang.sh b/hack/lib/golang.sh
index 127d6b88a..14d530a93 100644
--- a/hack/lib/golang.sh
+++ b/hack/lib/golang.sh
@@ -202,15 +202,17 @@ kubeedge::golang::build_binaries() {
local -a binaries
while IFS="" read -r binary; do binaries+=("$binary"); done < <(kubeedge::golang::binaries_from_targets "${targets[@]}")
- local ldflags
- read -r ldflags <<< "$(kubeedge::version::ldflags)"
+ local goldflags gogcflags
+ # If GOLDFLAGS is unset, then set it to the a default of "-s -w".
+ goldflags="${GOLDFLAGS=-s -w -buildid=} $(kubeedge::version::ldflags)"
+ gogcflags="${GOGCFLAGS:-}"
mkdir -p ${KUBEEDGE_OUTPUT_BINPATH}
for bin in ${binaries[@]}; do
echo "building $bin"
local name="${bin##*/}"
set -x
- go build -o ${KUBEEDGE_OUTPUT_BINPATH}/${name} -ldflags "$ldflags" $bin
+ go build -o ${KUBEEDGE_OUTPUT_BINPATH}/${name} -gcflags="${gogcflags:-}" -ldflags "${goldflags:-}" $bin
set +x
done