H
H
hitakiri2017-01-30 09:33:36
go
hitakiri, 2017-01-30 09:33:36

Why is Go building such a large file?

The question is why does GO build such large .exe files?

// helloworld.go
package main

import (
  "fmt"
)

func main() {
  fmt.Println("Hello World!")
}

It takes as much: 1.62 Mb .
This is not a complaint, I'm just wondering what could be there, for a simple output of "Hello World!" .

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
sim3x, 2017-01-30
@hitakiri

stackoverflow.com/questions/28576173/reason-for-hu...

M
malbaron, 2017-02-06
@malbaron

Because that's how the developers intended.
Any program with a small executable actually requires a bunch of libraries installed on the system. And even certain versions of these libraries.
Go is designed to be as portable as possible.
Therefore, the compiled file drags all the libraries in itself.
What allows you does not depend on the versions of the libraries installed in the system
. If you fundamentally need to reduce the file size of a program written in Go, then this is also possible
. There are also such keys for compiling.

X
xuBpaloLim, 2017-09-30
@xuBpaloLim

A C program, if you compile it with static rather than dynamic libraries , will also take a decent amount of time.
It's just that Go compiles with static ones by default . To avoid the problem of "library hell" when deploying.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question