#!/bin/bash set -eu # Builds CLI binary for current platform only and outside docker to speed up things. Suitable for local development. bindir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" rootdir="$( cd $bindir/.. && pwd )" . $bindir/_tag.sh current_platform=$(uname) host_platform="windows" if [ "${current_platform}" = 'Darwin' ]; then host_platform="darwin" elif [ "${current_platform}" = 'Linux' ]; then host_platform="linux" fi ( cd $rootdir cd "$(pwd -P)" if [ -z "${LINKERD_SKIP_DEP:-}" ]; then $bindir/dep ensure -vendor-only -v fi target="target/cli/${host_platform}/linkerd" CGO_ENABLED=0 go build -o $target -ldflags "-s -w -X github.com/linkerd/linkerd2/pkg/version.Version=$($bindir/root-tag)" ./cli echo "$target" )