scrooloose/syntastic — pull request #393 by ChristophMartin (2012-10-26 11:04:08+00:00)
Title: Fixes Golang Syntax Checker

This is a cleaned up https://github.com/scrooloose/syntastic/pull/343

Problem: The current default syntax checker for go is broken:
* `go build` won't catch syntax errors in the current file if there exists another broken file in the same package that will be compiled first by `go build`.
* `go build` must be run from the package directory.
* Test files are not compiled by `go build`, `go test` must be used for those.

Solution: Run `gofmt` on the file first, using an invocation that does not alter the file.
This will catch syntax errors for the current file. If `gofmt` does not find any errors, run `go build` or `go test`, which catches undefined variables, mismatched argument/return value counts...

Additional Changes:
* Drop the 6g syntax checker.
* Specific only to 64 bit platforms.
* Superseded by the go tool.
* Often not even in the $PATH anymore.
* Update gofmt.vim to use a more efficient `gofmt` invocation.
* Explain that `gofmt` is run without altering the source code.