One of the surprising things about using Google Go is the size of the created exe files. In the previous guide, the basic Hello World program was around 2.5MB! The equivalent C program is usually < 50KB
The two main reasons for this are:
The Go runtime that is included with every Go program. This handles memory management and other things. We can't really do anything about this.
Debug information and other meta information is included in every exe to assist with things like debugging and crash reports. This stuff we can safely strip from our exe file!
To make an exe file without the debug/meta information we build using the following command go build -ldflags="-s -w"
So, to make our previous Hello World program smaller, we navigate to that folder and run the build as follows:
C:\Hello World>go build -ldflags="-s -w" C:\Hello World>
This brings the file size down to around 1.6MB, still big but better than it was. One thing to note is that a lot of this size is fixed, so as your program grows, the exe will not grow as rapidly.
Updated (05/08/2026)