News for hackers. Stuff that matters.
Re:Why are my Go executable files so large? by Exuma on Sunday December 29, 2019 @02:06PM (#21907745)
So what would a solution be? How do other languages solve that problem?
Re:Why are my Go executable files so large? by umanwizard on Sunday December 29, 2019 @02:20PM (#21907845)
In my experience you would strip the symbols out of the prod binary, and save them separately somewhere.

Then your production binary will give you stack traces like [0x12345, 0xabcde, ...], but you can use the separately-stored files to symbolicate them and get the source file/line info.

Not sure if this is possible on all platforms but it at least is for all combinations of {C, C++, Objective-C, Rust} and { Linux, macOS, iOS } .

And if that added operational complexity is not worth the size savings, you can freely choose not to do it, and things will work like they do in Go.

Re:Why are my Go executable files so large? by Jasper_ on Sunday December 29, 2019 @02:23PM (#21907861)
Separable debuginfo which can be loaded at runtime. DWARF uses an efficient compression mechanism much smarter than a table for this sort of mapping. And of course things like coredumps and crash dumps being sent to automated processing where devtools have the full debug symbols, while production deployments do not.

Go's insistance not just reinventing the wheel but on actively ignoring core infrastructure improvements made in the last 20 years is bizarre.

Re:Why are my Go executable files so large? by loeg on Sunday December 29, 2019 @10:04PM (#21910454)
DWARF will also just gzip sections, in addition to the compressed format.
Re:Why are my Go executable files so large? by zorked on Sunday December 29, 2019 @02:14PM (#21907801)
That is debug information. Just have it stored elsewhere (not on the binary you ship everywhere) and use that in conjunction with your core dump to debug.
Re:Why are my Go executable files so large? by asveikau on Sunday December 29, 2019 @02:17PM (#21907826)
A lot of them have symbol files separate from the binary. Unixy tooling doesn't do this by default but for example objcopy(1) in binutils can copy symbols to another file before you run strip(1), and on Mac my memory is rusty but I think it may be dsymutil(1) that lets you copy to a .dSYM bundle. Microsoft has its .pdb files and never even keeps debug info inside the binary proper.
Re:Why are my Go executable files so large? by iainmerrick on Sunday December 29, 2019 @02:23PM (#21907856)
The debug info is in a separate file. You only need that file when you’re inspecting a crash report, so it doesn’t need to be pushed out to the host device(s).
Re:Why are my Go executable files so large? by unnouinceput on Sunday December 29, 2019 @02:17PM (#21907828)
Because it's not a problem. So everybody does the same. And is not about the programming language, is about the programmer's choice. If it wants debug info inside a production program, the language let it happens. In today's age size of your executable is a non-issue. The only issue should be your performance.

Here is an example from my past. As embedded programmer I went and added manually a hundred lines of constants, which initially were just an array generated at start and increased that code by about 5%. Why? Because I gained 5 ms in execution speed. And in embedded world that's huge. Especially when your code is executed on the lowest 10 ms cycle. So the department head approved such a huge change because the code size doesn't matter, you can always buy a bigger chip, but if your car don't start because the watchdog keeps resetting your car's on-board computer then speed in code execution is everything.

Re:Why are my Go executable files so large? by saagarjha on Sunday December 29, 2019 @04:15PM (#21908538)
> Because it's not a problem. So everybody does the same. And is not about the programming language, is about the programmer's choice. If it wants debug info inside a production program, the language let it happens. In today's age size of your executable is a non-issue. The only issue should be your performance.

No.

Re:Why are my Go executable files so large? by mjcohen on Monday December 30, 2019 @12:59AM (#21911149)
Well, that settles that.
Re:Why are my Go executable files so large? by saagarjha on Monday December 30, 2019 @02:32AM (#21911505)
I figured that it would be fairly obvious why claiming that executable size means little today and that performance is the only metric that matters is a gross misrepresentation of the software industry.
Re:Why are my Go executable files so large? by mynegation on Sunday December 29, 2019 @02:17PM (#21907827)
I do not know much about go, but languages like C++ and Java give you the tools to make tradeoffs appropriate to your situation: externalizing or stripping symbols and/or debugging information.