Skip to content

Instantly share code, notes, and snippets.

@bizenn
Created August 21, 2020 04:05
Show Gist options
  • Save bizenn/7bfdcebb5785f31736b11840f2bdb636 to your computer and use it in GitHub Desktop.
Save bizenn/7bfdcebb5785f31736b11840f2bdb636 to your computer and use it in GitHub Desktop.
go-import-add の候補にシステムのパッケージが含まれなくなってしまったので、無理矢理回避
;; go-system-packagesの初期化はもう少しマシな実装がありそうな気がする
(defvar go-system-packages nil)
(use-package go-mode
:ensure t
:ensure go-eldoc
:ensure flycheck-gometalinter
:ensure godoctor
:init
(add-hook 'go-mode-hook 'go-eldoc-setup)
(add-hook 'go-mode-hook 'flycheck-mode)
(add-hook 'before-save-hook 'gofmt-before-save)
:config
(set-face-attribute 'eldoc-highlight-function-argument nil
:underline t :foreground "green"
:weight 'bold)
(flycheck-gometalinter-setup)
(setq flycheck-gometalinter-fast 1
flycheck-gometalinter-test 1)
(setq go-system-packages
(let ((owd default-directory))
(cd "~/")
(let ((l (go-packages-go-list)))
(cd owd)
l)))
:custom
(go-packages-function
(lambda ()
(append go-system-packages
(process-lines go-command "list" "-m" "-f" "{{.Path}}" "all")
(process-lines go-command "list" "-e" "all"))))
:bind
("M-." . godef-jump))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment