Use the go build command with the -gcflags flag to enable compiler timing output, which prints the time spent in each compilation phase to stderr. Run the following command to see the breakdown of compile times for your package:
go build -gcflags="-m -l" ./...
For more detailed timing specifically for the compiler, use the -gcflags=all=-m -gcflags=all=-l flags or enable the compile debug setting via GODEBUG if available in your toolchain version, though standard timing is best viewed via the compiler's verbose output. To profile the build process itself, use go tool compile -V or inspect the go build output with -v to see package durations.