golang – Why is the Go executable much larger than C?

Question:

For example.

hi.c.

#include <stdio.h>

int main() {
    printf("C\n");
}

hi.go

package main

import "fmt"

func main() {
    fmt.Println("Go")
}

We collect:

$ gcc -o c hi.c
$ 8g hi.go && 8l -o go hi.8

We get:

$ ls -l

  7088 2010-10-29 21:33 c*
953840 2010-10-29 21:33 go*

Answer:

The answer is quite obvious: a Go program pulls a big and fat main package, while a C program pulls only stdio

Scroll to Top