Skip to content

Instantly share code, notes, and snippets.

@rms1000watt
Last active November 13, 2025 00:46
Show Gist options
  • Select an option

  • Save rms1000watt/e6fcdadf26ae10c7df3b3e8a0dc4d7e9 to your computer and use it in GitHub Desktop.

Select an option

Save rms1000watt/e6fcdadf26ae10c7df3b3e8a0dc4d7e9 to your computer and use it in GitHub Desktop.
Go Build command with netgo
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -tags netgo -installsuffix netgo -o bin/linux-golang-server
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -tags netgo -installsuffix netgo -ldflags '-w -extldflags "-static"' -o bin/linux-golang-server
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -tags netgo -installsuffix netgo -ldflags '-w -extldflags=-static' -o bin/linux-golang-server
Copy link

ghost commented Nov 13, 2025

go build -tags netgo -ldflags '-s -w' -o app

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment