go: reformat spacemacs/go-packages-gopkgs

Use setq instead of customize
Put spacemacs//go-set-tab-width in funcs.el
This commit is contained in:
syl20bnr 2018-06-09 00:43:52 -04:00
parent 938155c50a
commit 7951d763e3
2 changed files with 8 additions and 8 deletions

View file

@ -9,7 +9,11 @@
;; ;;
;;; License: GPLv3 ;;; License: GPLv3
(defun load-gopath-file(gopath name) (defun spacemacs//go-set-tab-width ()
"Set the tab width."
(setq-local tab-width go-tab-width))
(defun load-gopath-file (gopath name)
"Search for NAME file in all paths referenced in GOPATH." "Search for NAME file in all paths referenced in GOPATH."
(let* ((sep (if (spacemacs/system-is-mswindows) ";" ":")) (let* ((sep (if (spacemacs/system-is-mswindows) ";" ":"))
(paths (split-string gopath sep)) (paths (split-string gopath sep))
@ -73,6 +77,4 @@
(buffer-file-name (buffer-base-buffer))))))) (buffer-file-name (buffer-base-buffer)))))))
(defun spacemacs/go-packages-gopkgs () (defun spacemacs/go-packages-gopkgs ()
"Return a list of all Go packages, using `gopkgs'." "Return a list of all Go packages, using `gopkgs'."
(sort (sort (process-lines "gopkgs") #'string<))
(process-lines "gopkgs")
#'string<))

View file

@ -59,11 +59,9 @@
:defer t :defer t
:init :init
(progn (progn
(defun spacemacs//go-set-tab-width () ;; get go packages much faster
"Set the tab width." (setq 'go-packages-function 'spacemacs/go-packages-gopkgs)
(setq-local tab-width go-tab-width))
(add-hook 'go-mode-hook 'spacemacs//go-set-tab-width)) (add-hook 'go-mode-hook 'spacemacs//go-set-tab-width))
(customize-set-variable 'go-packages-function 'spacemacs/go-packages-gopkgs)
:config :config
(progn (progn
(add-hook 'before-save-hook 'gofmt-before-save) (add-hook 'before-save-hook 'gofmt-before-save)