Skip to content

Instantly share code, notes, and snippets.

@TripleDogDare
Created August 15, 2017 23:00
Show Gist options
  • Save TripleDogDare/bea0e52166da1fea3f992a938c037770 to your computer and use it in GitHub Desktop.
Save TripleDogDare/bea0e52166da1fea3f992a938c037770 to your computer and use it in GitHub Desktop.
statically linked builds of go binaries
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -tags netgo -installsuffix netgo main.go
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' main.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment