Skip to content

Instantly share code, notes, and snippets.

@thomasf
Created March 12, 2015 19:48
Show Gist options
  • Save thomasf/139d3b49ee3a3f079d01 to your computer and use it in GitHub Desktop.
Save thomasf/139d3b49ee3a3f079d01 to your computer and use it in GitHub Desktop.
(use-package go-mode
:ensure t
:mode "\\.go\\'"
:config
(progn
(defun gopath-set-here ()
(interactive)
(message (or (buffer-file-name) default-directory))
(setenv "GOPATH"
(f-expand (or (buffer-file-name) default-directory))))
(setq gofmt-command (cond
((executable-find "goimports") "goimports")
(t "gofmt")))
(use-package go-stacktracer
:ensure t
:commands (go-stacktracer-region))
(use-package go-eldoc
:ensure t
:init
(progn
(add-hook 'go-mode-hook 'go-eldoc-setup)))
(use-package go-autocomplete
:ensure t
:pre-load
(progn
(use-package auto-complete :ensure t))
:init
(progn
(add-hook 'go-mode-hook
#'(lambda ()
;;; NOTE placing ac-source-yasnippet first is a work around.
;; This is probably still an issue for modes where ac-source-yasnippet is
;; not the last source.. (maybe) any source that has a prefix parser must
;; be placed last until this issue is resolved.
;; auto-complete/auto-complete#348 (comment)
(setq ac-sources
'(ac-source-yasnippet
ac-source-go))))))
(bind-key "M-." 'godef-jump go-mode-map)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment