Not a compiler check, but staticcheck is widely used:
% staticcheck test.go test.go:7:2: this value of err is never used (SA4006)