4 ms·
First, great tool! The README makes me want to try it immediately. I love how the Kubernetes client for Go is always the culprit for adding dozens of megabytes
by koito17 2y ago
First, great tool! The README makes me want to try it immediately.
I love how the Kubernetes client for Go is always the culprit for adding dozens of megabytes to binary sizes. Thankfully, its impact on binary size is decreasing as the codebase adopts generics.
Out of curiosity, how well does this work with stripped binaries? Many people interested in reducing binary size will often strip debug symbols and add "-a -s" to LDFLAGS, so what identifying information of a package is left in a binary? Besides VCS information (unless the binary was also built with -buildvcs=false so Git commit hashes aren't baked into the binary).
- zxilly 2y agoEven if the debugging information is stripped out, this tool can still extract a lot of information. This is because Go keeps a lot of specific information about functions in its pclntab table inside the binary for reflection, GC or other work. The tool is able to analyse this part of the information. Also, it includes a rudimentary decompiler for extracting possible static data calls from the binary, which is simple, but seems to work well.
- peterldowns 2y agoheads up that you probably want `-ldflags="-w -s"`, not `"-a -s"`, since `-a` is now a no-op. See `go tool link` for more info.