Remove '-s' flag from ldflags from the build

This retains the symbols (but still removes the dwarf info).
This increases the executable size by ~8% (test on my laptop):

$ go build -ldflags '-w' -o nats-server
-rwxrwxr-x 1 yzhao yzhao 11911273 Jul 28 15:52 nats-server

$ go build -ldflags '-s -w' -o nats-server
-rwxrwxr-x 1 yzhao yzhao 11128832 Jul 28 15:52 nats-server

Symbols are very useful during debugging. It would be great that if the
NATS team consider including symbols.
This commit is contained in:
Yaxiong Zhao
2021-07-28 15:56:58 -07:00
parent c3ba9f03f5
commit b0cecaf666
3 changed files with 3 additions and 3 deletions

View File

@@ -14,7 +14,7 @@ builds:
- main: ./main.go
binary: nats-server
ldflags:
- -s -w -X github.com/nats-io/nats-server/server.gitCommit={{.ShortCommit}}
- -w -X github.com/nats-io/nats-server/server.gitCommit={{.ShortCommit}}
env:
- GO111MODULE=off
- CGO_ENABLED=0