Go交叉编译

151 阅读1分钟
build() {
    type=$(uname)

    if [ ${type} == "Darwin" ]; then
        CGO_ENABLE=1 GOOS=linux GOARCH=amd64 go build -ldflags "$GO_LDFLAGS" \
		    -o "${BINARY_DEST}/boa-${RAW_VERSION}" ${CMD_PATH} || return
    elif [ ${type} == "Linux" ]; then
        go build -ldflags "$GO_LDFLAGS" \
		    -o "${BINARY_DEST}/boa-${RAW_VERSION}" ${CMD_PATH} || return
    else
        echo "Wrong platform!"
    fi
}