scrooloose/syntastic — pull request #343 by ghthor (2012-09-05 06:02:13+00:00)
Title: Golang go cmd syntax checks

I've made some updates to the go syntax checker via the `go` cmd.

It initially checks via `go fmt` and if there are any errors it returns those. If `go fmt` passes then it updates the buffer by filtering through `gofmt` since `go fmt` will update formatting on disk but not in the buffer.

If the go file is a test file then `go build` will not end up checking it so we check for this and instead use `go test -c` which at this time will generate a test executable in the package directory named `packagename.test` and there isn't an option to avoid creating this file but this is a quick and easy way to do syntax checking on all *.go files. It could be removed after `SyntasticMake` is called but I don't see any problem with leaving it lying around as it should be ignored by the DVCS anyway and `go clean` will remove it.

There are some problems with using `go build` & `go test` if you are editing a file that isn't in the current directory since they operate on the current directory. Is there a simple way to `cd` to the buffers directory run `lmake` and then `cd` back to the original directory?