On Wed, May 27, 2020 at 10:08 AM X Xiao <laosha...@gmail.com> wrote:
>
> what's the difference between `go build -ldflags="-s -w"` and `go build` plus 
> `strip myBinary`? it seems their result is different, sometimes running 
> `strip` gives me smaller size, then why bother with ldflags?

I just tried a simple hello, world test and running strip produced a
larger binary (on amd64 GNU/Linux).  I think the results are going to
depend on the exact section sizes and alignments.  The strip program
is of course a general tool, that knows nothing about Go, that
produces a new copy of the executable.

That said, broadly speaking there shouldn't be any real difference in
the final result.  You should use whichever works better for you.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcWC58-wzFULkGi48px_bQQw1CFX0dGM9CNeQbB3Dnd%2BZg%40mail.gmail.com.

Reply via email to