Answer the question
In order to leave comments, you need to log in
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!")
}
Answer the question
In order to leave comments, you need to log in
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.
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 questionAsk a Question
731 491 924 answers to any question