Just use cgo_enabled for static binaries
@@ -73,7 +73,6 @@ build_binary () {
local goarch=$2
local cmd=$3
local cmd_name=$4
- local static=$5
local outfile="target/${goos}-${goarch}/${cmd_name}"
@@ -87,11 +86,8 @@ build_binary () {
local ldflags+=" -X $version_pkg.PreReleaseIdentifier=${prerelease}"
local ldflags+=" -X $version_pkg.BuildDate=${build_date}"
local ldflags+=" -X $version_pkg.BuildSHA=${build_sha}"
- if [ "$static" == "static" ]; then
- local ldflags+=" -linkmode=external -extldflags=-static"
- fi
- GOOS=$goos GOARCH=$goarch go build -ldflags "${ldflags}" -i -o $outfile ${REPO_PATH}/${cmd}/cmd/...
+ CGO_ENABLED=0 GOOS=$goos GOARCH=$goarch go build -ldflags "${ldflags}" -i -o $outfile ${REPO_PATH}/${cmd}/cmd/...
echo $outfile
}
@@ -198,7 +194,7 @@ docker_commands () {
for cmd in agent backend cli; do
echo "Building $cmd for linux-amd64"
local cmd_name=$(cmd_name_map $cmd)
- build_binary linux amd64 $cmd $cmd_name static
+ build_binary linux amd64 $cmd $cmd_name
done
docker build --label build.sha=${build_sha} -t sensuapp/sensu-go .
