Skip to content

Instantly share code, notes, and snippets.

@kauefraga
Created December 6, 2023 20:54
Show Gist options
  • Save kauefraga/716d3c596e9245504f4dd23a0051eafc to your computer and use it in GitHub Desktop.
Save kauefraga/716d3c596e9245504f4dd23a0051eafc to your computer and use it in GitHub Desktop.
🐹 A simple cross-platform build script (for Golang).
# Remember to indent with tabs
BINARY_FOLDER=bin
BINARY_NAME={}
debug:
go build -o debug/${BINARY_NAME} ./src/main.go
./debug/${BINARY_NAME}
# -ldflags=-w remove unnecessary debug tools
release:
GOOS=darwin go build -ldflags=-w -o ${BINARY_FOLDER}/darwin/${BINARY_NAME} ./src/main.go
GOOS=linux go build -ldflags=-w -o ${BINARY_FOLDER}/linux/${BINARY_NAME} ./src/main.go
GOOS=windows go build -ldflags=-w -o ${BINARY_FOLDER}/windows/${BINARY_NAME}.exe ./src/main.go
clean:
go clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment