Re: go: shrink binaries

Jörg Sonnenberger <[email protected]> Tue, 26 May 2026 13:46:37 +0200
Newsgroups gmane.os.netbsd.devel.packages
Message-ID <[email protected]>
On 5/26/26 1:07 AM, Greg Troxel wrote:
> Jörg Sonnenberger <[email protected]> writes:
> 
>> On 5/25/26 9:00 AM, Adam wrote:
>>> Hello,
>>> To all go modules, can we add:
>>> -ldflags='-s -w' to omit symbol table (-s) and strip debug
>>> information (-w), and also
>>> -trimpath to avoid baking full GOPATH/module paths into binaries (without it, there is a work directory reference, so CHECK_WRKREF_SKIP can possible be removed in lang/go/go-module.mk)
>>
>> I wouldn't want to strip symbol tables by default, that can make any
>> debugging a lot more painful for little gain. Debug information is a
>> different question.
> 
> I had the impression we had variables to control this and would think
> that go binaries should have the exact same treatment as C binaries.
> 
>    $ nm -g /usr/pkg/bin/gm4
>    nm: /usr/pkg/bin/gm4: no symbols
> 
> If you want to argue for changing the default and/or separating
> variables for symbols and debug, that's ok.  But I don't see why go
> should be different.

The patch doesn't seem to honor the flags?

Joerg