Skip to content

cmd/compile: takes too much cpu and fails when compiling huge go files #14082

@ghost

Description

I use this go-embed tool for embedding resources into my executable directly. It produces a file like this https://github.com/pyros2097/go-embed/blob/master/examples/assets/main_prod.go.

But When I use this to build my frontend images which approximates to 20MB into a single main.go file which is also 20MB but is 300K+ lines of code It takes forever to compile and then crashes my CPU. I guess this is a problem because I have only 4GB of memory and an core i3 processor.
But it seems to compile properly on my friends 16GB laptop core i7.

Is there anyway I can make it compile on my laptop? Maybe by splitting the single file into many files or something?

My GoENV and go version go1.5.2 linux/amd64

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/pyros2097/Code"
GORACE=""
GOROOT="/usr/lib/go"
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT="1"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.ToolSpeed

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions