Created
April 19, 2016 06:53
-
-
Save jimmo/9f73cb0b5997bce6c4d2ef438686b2f8 to your computer and use it in GitHub Desktop.
Minimal Go config for Emacs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Go | |
;; Requires: go get github.com/rogpeppe/godef | |
;; go get github.com/nsf/gocode | |
(defun jim-go-mode () | |
;; gofmt on save. | |
(add-hook 'before-save-hook 'gofmt-before-save) | |
;; Add flymake support for go. | |
(require 'flymake-go) | |
(flymake-mode) | |
;; Auto-complete support | |
(auto-complete-mode 1) | |
;; Compile support | |
(if (not (string-match "go build" compile-command)) | |
(set (make-local-variable 'compile-command) | |
"go build -v && go test -v && go vet")) | |
;; 8-wide tabs are too wide. | |
(setq tab-width 2)) | |
(add-hook 'go-mode-hook 'jim-go-mode) | |
(with-eval-after-load 'go-mode | |
(require 'go-autocomplete)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment