Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions scripts/go-tool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,19 @@ if [[ "${CGO_ENABLED}" != 0 ]]; then
fi

function invoke_go() {
tool="$1"
local tool="${1:?"invoke_go tool argument required"}"
shift
local args=()
local CGO_ENABLED

args+=("-buildvcs=false")
args+=(-ldflags="${ldflags[*]}")
args+=(-tags "$(tr , ' ' <<<"$GOTAGS")")
if [[ "$RACE" == "true" ]]; then
CGO_ENABLED=1 go "$tool" -race -ldflags="${ldflags[*]}" -tags "$(tr , ' ' <<<"$GOTAGS")" "$@"
else
go "$tool" -ldflags="${ldflags[*]}" -tags "$(tr , ' ' <<<"$GOTAGS")" "$@"
export CGO_ENABLED=1
args+=("-race")
fi
go "$tool" "${args[@]}" "$@"
}

function go_build() (
Expand Down
Loading