The Go compiler normally stops after it finds 10 errors, aborting with a
This is useful default behaviour - if there's lots problems you usually
don't care about seeing all of the issues. You just fix what you can see
and try again.</p>
Sometimes though you really want to see all the errors.</p>
The trick is to use the Here's how you do it:</p>
Given that this was surprisingly difficult to find this I thought I'd
write it down here. Hope this was useful.</p>too many errors</code> message. For example:</p>
$ go build </span></span>
# sandbox/manyerrs</span></span>
./errs.go:4: undefined: w</span></span>
./errs.go:5: undefined: w</span></span>
./errs.go:6: undefined: w</span></span>
./errs.go:7: undefined: w</span></span>
./errs.go:8: undefined: w</span></span>
./errs.go:9: undefined: w</span></span>
./errs.go:10: undefined: w</span></span>
./errs.go:11: undefined: w</span></span>
./errs.go:12: undefined: w</span></span>
./errs.go:13: undefined: w</span></span>
./errs.go:13: too many errors</span></span></code></pre>
-gcflags</code> option to the go</code> tool to pass -e</code>
(show all errors) to the compiler.</p>
$ go build -gcflags="-e"</span></span>
./errs.go:4: undefined: w</span></span>
./errs.go:5: undefined: w</span></span>
./errs.go:6: undefined: w</span></span>
./errs.go:7: undefined: w</span></span>
./errs.go:8: undefined: w</span></span>
./errs.go:9: undefined: w</span></span>
./errs.go:10: undefined: w</span></span>
./errs.go:11: undefined: w</span></span>
./errs.go:12: undefined: w</span></span>
./errs.go:13: undefined: w</span></span>
./errs.go:14: undefined: w</span></span>
./errs.go:15: undefined: w</span></span>
./errs.go:16: undefined: w</span></span>
./errs.go:17: undefined: w</span></span></code></pre>
This page cannot be shown here. You can still read it on the original site — the toolbar below keeps your place in the directory.
The Go compiler normally stops after it finds 10 errors, aborting with a too many errors message. For example: $ go build # sandbox/manyerrs ./errs.go:4: undefined: w ./errs.go:5: undefined: w ./errs.go:6: undefined: w ./errs.go:7: undefined: w ./errs.go:8: undefined: w ./errs.go:9: undefined: w ./errs.go:10: undefined: w ./errs.go:11: undefined: w…

Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.