Kokizzu
Kokizzu

Reputation: 26818

How to trace Golang's slow compile?

I have a company's project, which took about 13s to compile on SSD on even minor changes. My other projects only took 1.55-1.79s to recompile on minor changes (0.42s when nothing changed). How to trace which package/part that causes this lag?

there's no import "C" in the source code.

Upvotes: 2

Views: 1603

Answers (2)

Kokizzu
Kokizzu

Reputation: 26818

There's undocumented flag to show timings of each steps:

go build -debug-actiongraph=compile.json 

Upvotes: 2

Lobo Nokewe Ngewe
Lobo Nokewe Ngewe

Reputation: 183

you could add -x option to your go build command to use debugging mode

Upvotes: 2

Related Questions