go: make go-tab-width a regular layer variable
This commit is contained in:
parent
4129264302
commit
74fb719b44
|
@ -11,6 +11,7 @@
|
|||
- [[#configuration][Configuration]]
|
||||
- [[#formatting][Formatting]]
|
||||
- [[#indentation][Indentation]]
|
||||
- [[#tests][Tests]]
|
||||
- [[#working-with-go][Working with Go]]
|
||||
- [[#go-commands-start-with-m][Go commands (start with =m=):]]
|
||||
- [[#go-oracle][Go Oracle]]
|
||||
|
@ -62,19 +63,14 @@ or
|
|||
#+end_src
|
||||
|
||||
** Indentation
|
||||
By default, the width of tab in Go mode is 8 spaces. To use a different value
|
||||
for tab width, set the value of =go-tab-width=, e.g.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(setq go-tab-width 4)
|
||||
#+end_src
|
||||
|
||||
or
|
||||
By default, the tab widt in Go mode is 8 spaces. To use a different value
|
||||
set the layer variable =go-tab-width=, e.g.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(go :variables go-tab-width 4)
|
||||
#+end_src
|
||||
|
||||
** Tests
|
||||
If you're using =gocheck= in your project you can use the
|
||||
=go-use-gocheck-for-testing= variable to enable suite testing and to get single
|
||||
function testing to work.
|
||||
|
|
|
@ -15,3 +15,6 @@
|
|||
|
||||
(defvar go-use-gocheck-for-testing nil
|
||||
"If using gocheck for testing when running the tests -check.f will be used instead of -run to specify the test that will be ran. Gocheck is mandatory for testing suites.")
|
||||
|
||||
(defvar go-tab-width 8
|
||||
"Set the `tab-width' in Go mode. Default is 8.")
|
||||
|
|
|
@ -9,11 +9,6 @@
|
|||
(go-rename :location local)
|
||||
))
|
||||
|
||||
(defcustom go-tab-width 8
|
||||
"`tab-width' in Go mode. Default is 8."
|
||||
:type 'integer
|
||||
:group 'go)
|
||||
|
||||
(defun go/post-init-flycheck ()
|
||||
(spacemacs/add-flycheck-hook 'go-mode))
|
||||
|
||||
|
@ -23,12 +18,14 @@
|
|||
(unless (getenv var)
|
||||
(exec-path-from-shell-copy-env var))))
|
||||
|
||||
(add-hook 'go-mode-hook
|
||||
(lambda ()
|
||||
(setq-local tab-width go-tab-width)))
|
||||
|
||||
(use-package go-mode
|
||||
:defer t
|
||||
:init
|
||||
(progn
|
||||
(defun spacemacs//go-set-tab-width ()
|
||||
"Set the tab width."
|
||||
(setq-local tab-width go-tab-width))
|
||||
(add-hook 'go-mode-hook 'spacemacs//go-set-tab-width))
|
||||
:config
|
||||
(progn
|
||||
(add-hook 'before-save-hook 'gofmt-before-save)
|
||||
|
|
Loading…
Reference in New Issue