From 01cad7be5abd55ac96739884db84032e809effd1 Mon Sep 17 00:00:00 2001 From: Alden Timme Date: Tue, 12 Dec 2023 09:33:20 -0800 Subject: [PATCH] More clean-up --- DEV.md | 3 +-- Makefile | 4 ++-- scripts/build-bin.sh | 2 +- scripts/build-dist.sh | 8 ++++---- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/DEV.md b/DEV.md index 25171b4..af054d4 100644 --- a/DEV.md +++ b/DEV.md @@ -21,10 +21,9 @@ To release an update to `gocsv`, make sure you have committed and pushed the mos ``` -2. Create cross-compiled binaries for distribution. Cross-compilation uses [xgo](https://github.com/karalabe/xgo) to handle issues with CGO packages in other platforms and architectures. Because `xgo` requires `docker`, you will need `docker` installed. +2. Create cross-compiled binaries for distribution. ```shell - go get -u github.com/karalabe/xgo make dist ``` diff --git a/Makefile b/Makefile index 6ca6f58..705e5cd 100644 --- a/Makefile +++ b/Makefile @@ -11,8 +11,8 @@ dist: bash scripts/build-dist.sh test: - cd $(CMD_DIR) && GO111MODULE=on go test -cover - cd $(CSV_DIR) && GO111MODULE=on go test -cover + cd $(CMD_DIR) && go test -cover + cd $(CSV_DIR) && go test -cover bin: bash scripts/build-bin.sh diff --git a/scripts/build-bin.sh b/scripts/build-bin.sh index 4cc0d3a..1742e19 100644 --- a/scripts/build-bin.sh +++ b/scripts/build-bin.sh @@ -9,4 +9,4 @@ LD_FLAGS="-X github.com/aotimme/gocsv/cmd.VERSION=${VERSION} -X github.com/aotim rm -rf ${BIN_DIR} mkdir -p ${BIN_DIR} -GO111MODULE=on go build -ldflags "${LD_FLAGS}" -o ${BIN_DIR}/${EXECUTABLE} \ No newline at end of file +go build -ldflags "${LD_FLAGS}" -o ${BIN_DIR}/${EXECUTABLE} \ No newline at end of file diff --git a/scripts/build-dist.sh b/scripts/build-dist.sh index 535457e..7e38e38 100644 --- a/scripts/build-dist.sh +++ b/scripts/build-dist.sh @@ -7,9 +7,6 @@ GIT_HASH=$(git rev-parse HEAD) VERSION=$(git describe --tags HEAD) LD_FLAGS="-X github.com/aotimme/gocsv/cmd.VERSION=${VERSION} -X github.com/aotimme/gocsv/cmd.GIT_HASH=${GIT_HASH}" -rm -rf ${DIST_DIR} -mkdir ${DIST_DIR} - # Create an array of goos:goarch pairs options=( "darwin:amd64" @@ -27,6 +24,9 @@ options=( ) echo "Building into ${DIST_DIR}/..." +rm -rf ${DIST_DIR} +mkdir ${DIST_DIR} + for option in "${options[@]}"; do IFS=':' read -r goos goarch <<< "$option" @@ -39,7 +39,7 @@ for option in "${options[@]}"; do if [ "$goos" == "windows" ]; then binary="${EXECUTABLE}.exe" fi - GOOS=${goos} GOARCH=${goarch} GO111MODULE=on go build -ldflags "${LD_FLAGS}" -o ${BIN_DIR}/${binary} + GOOS=${goos} GOARCH=${goarch} go build -ldflags "${LD_FLAGS}" -o ${BIN_DIR}/${binary} cd ${DIST_DIR} zip -rq ${folder}.zip ${folder} rm -rf ${folder}