Configure the go-packages-functions to use the gopkgs tool

This is a much faster option than the current native function.
This commit is contained in:
Cosmin Cojocar 2018-03-29 12:19:21 +02:00 committed by syl20bnr
parent 0fd13aef2b
commit 938155c50a
3 changed files with 7 additions and 0 deletions

View File

@ -43,6 +43,7 @@ You will need =gocode=, =gogetdoc=, =godef= and =godoctor=:
go get -u -v golang.org/x/tools/cmd/goimports
go get -u -v github.com/zmb3/gogetdoc
go get -u -v github.com/cweill/gotests/...
go get -u github.com/haya14busa/gopkgs/cmd/gopkgs
#+END_SRC
If you wish to use =gometalinter= set the value of =go-use-gometalinter= to t:

View File

@ -71,3 +71,8 @@
(format "go run %s"
(shell-quote-argument (or (file-remote-p (buffer-file-name (buffer-base-buffer)) 'localname)
(buffer-file-name (buffer-base-buffer)))))))
(defun spacemacs/go-packages-gopkgs ()
"Return a list of all Go packages, using `gopkgs'."
(sort
(process-lines "gopkgs")
#'string<))

View File

@ -63,6 +63,7 @@
"Set the tab width."
(setq-local tab-width go-tab-width))
(add-hook 'go-mode-hook 'spacemacs//go-set-tab-width))
(customize-set-variable 'go-packages-function 'spacemacs/go-packages-gopkgs)
:config
(progn
(add-hook 'before-save-hook 'gofmt-before-save)