Skip to content

Commit

Permalink
More clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
aotimme committed Dec 12, 2023
1 parent cba013f commit 01cad7b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
3 changes: 1 addition & 2 deletions DEV.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-bin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
go build -ldflags "${LD_FLAGS}" -o ${BIN_DIR}/${EXECUTABLE}
8 changes: 4 additions & 4 deletions scripts/build-dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"

Expand All @@ -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}
Expand Down

0 comments on commit 01cad7b

Please sign in to comment.