Skip to content

Commit

Permalink
build: reduce binary size by adding -s -w to ldflags (#716)
Browse files Browse the repository at this point in the history
Add `-s` (omit symbol table and debug info) and `-w` (omit DWARF debug info) to linker flags to minimize the size of the generated binaries.

Signed-off-by: Rui Chen <rui@chenrui.dev>
Co-authored-by: Evan Gibler <20933572+egibs@users.noreply.github.com>
  • Loading branch information
chenrui333 and egibs authored Dec 18, 2024
1 parent f297f5d commit 0937ef5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ builds:
- -trimpath
mod_timestamp: '{{ .CommitTimestamp }}'
ldflags:
- -X main.BuildVersion={{.Version}}
- -s -w -X main.BuildVersion={{.Version}}

checksum:
name_template: 'checksums.txt'
Expand Down

0 comments on commit 0937ef5

Please sign in to comment.