Compiled file size


I’m new on Go and tried the “hello world” source code on the install page.

package main

import "fmt"

func main() {
    fmt.Printf("hello, world\n")
Wich after compiling the code it results in a 1.5 MB(!) executable (go 1.8/CentOS 7). Nearly the same code in C will only generate a few KB.

What makes this difference? Can I reduce it by including the right libs?



This is, literally, a FAQ:

In short, your Go program includes stuff not included in the C compiled equivalent, and depends less on it’s external environment. This, by the way, is awesome.


Ok, thx. I should read the FAQ first…

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.