The goflymake
program is a wrapper around the go
tool to provide
Emacs flymake style syntax checking for golang source files within
multi-file packages and _test.go files. Support for os/arch specific
cgo files is included thanks to the standard go/build package.
-
If needed, update your ${PATH} to include Go installed binaries, for example:
export PATH=${PATH}:${GOPATH}/bin
Depending on your Emacs workflow (e.g., windowing system environment), it may be required to explicitly set the following items:
(setenv "GOPATH" "/path/to/gopath")
(setenv "PATH" (concat (getenv "PATH") ":" "/extra/path/element"))
(setq exec-path (append exec-path (list (expand-file-name "/another/thing"))))
-
Install goflymake:
go get -u github.com/dougm/goflymake
-
Install go-mode.el if you haven't already
-
Add these lines to your .emacs or similar:
-
flymake
(add-to-list 'load-path "~/gocode/src/github.com/dougm/goflymake") (require 'go-flymake)
-
flycheck
(add-to-list 'load-path "~/gocode/src/github.com/dougm/goflymake") (require 'go-flycheck)
We probably shouldn't need the goflymake
program, the go
tool could
be tweaked to support the flymake style of syntax checking.
Maybe there is already a better way, but I couldn't find one.
The goflymake
command includes forensic information to assist in debugging
anomalies, which will assist you in tracking down the problem.
If worst comes to worst, the Flymake Troubleshooting Guide is definitely helpful.