[go] Switch layer variables to defcustoms
and fix wrong declaration of go-mode hooks
This commit is contained in:
parent
b3bf5c1fb4
commit
247d059289
|
@ -25,42 +25,52 @@
|
|||
|
||||
(spacemacs|define-jump-handlers go-mode godef-jump)
|
||||
|
||||
(defvar go-backend (if (configuration-layer/layer-used-p 'lsp) 'lsp 'go-mode)
|
||||
(spacemacs|defc go-backend (if (configuration-layer/layer-used-p 'lsp) 'lsp 'go-mode)
|
||||
"The backend to use for IDE features.
|
||||
Possible values are `go-mode' and `lsp'.
|
||||
If `nil' then `go-mode' is the default backend unless `lsp' layer is used.")
|
||||
(put 'go-backend 'safe-local-variable #'symbolp)
|
||||
Possible values are `lsp' and `go-mode'.
|
||||
If not set then `go-mode' is the default backend unless `lsp' layer is used."
|
||||
'(choice (const lsp) (const go-mode)) nil #'symbolp)
|
||||
|
||||
(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.")
|
||||
(spacemacs|defc 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."
|
||||
'boolean nil #'booleanp)
|
||||
|
||||
(defvar go-use-testify-for-testing nil
|
||||
"If using testify for testing when running the tests -testify.m will be used instead of -run to specify the test that will be ran. Testify is mandatory for testing suites.")
|
||||
(spacemacs|defc go-use-testify-for-testing nil
|
||||
"If using testify for testing when running the tests -testify.m will be used instead of -run to specify the test that will be ran. Testify is mandatory for testing suites."
|
||||
'boolean nil #'booleanp)
|
||||
|
||||
(defvar go-format-before-save nil
|
||||
"Use gofmt before save. Set to non-nil to enable gofmt before saving. Default is nil.")
|
||||
(put 'go-format-before-save 'safe-local-variable #'symbolp)
|
||||
(spacemacs|defc go-format-before-save nil
|
||||
"Use gofmt before save. Set to non-nil to enable gofmt before saving. Default is nil."
|
||||
'boolean nil #'booleanp)
|
||||
|
||||
(defvar go-tab-width 8
|
||||
"Set the `tab-width' in Go mode. Default is 8.")
|
||||
(spacemacs|defc go-tab-width 8
|
||||
"Set the `tab-width' in Go mode. Default is 8."
|
||||
'integer nil #'integerp)
|
||||
|
||||
(defvar go-use-golangci-lint nil
|
||||
"Use `golangci-lint' if the variable has non-nil value.")
|
||||
(spacemacs|defc go-use-golangci-lint nil
|
||||
"Use `golangci-lint' if the variable has non-nil value."
|
||||
'boolean nil #'booleanp)
|
||||
|
||||
(defvar go-test-buffer-name "*go test*"
|
||||
"Name of the buffer for go test output. Default is *go test*.")
|
||||
(spacemacs|defc go-test-buffer-name "*go test*"
|
||||
"Name of the buffer for go test output. Default is *go test*."
|
||||
'string nil #'stringp)
|
||||
|
||||
(defvar go-use-test-args ""
|
||||
"Additional arguments to be supplied to `go test` during runtime.")
|
||||
(spacemacs|defc go-use-test-args ""
|
||||
"Additional arguments to be supplied to `go test` during runtime."
|
||||
'string nil #'stringp)
|
||||
|
||||
(defvar go-test-verbose nil
|
||||
"Control verbosity of `go test` output")
|
||||
(spacemacs|defc go-test-verbose nil
|
||||
"Control verbosity of `go test` output"
|
||||
'boolean nil #'booleanp)
|
||||
|
||||
(defvar go-run-args ""
|
||||
"Additional arguments to by supplied to `go run` during runtime.")
|
||||
(spacemacs|defc go-run-args ""
|
||||
"Additional arguments to by supplied to `go run` during runtime."
|
||||
'string nil #'stringp)
|
||||
|
||||
(defvar go-run-command "go run"
|
||||
"Go run command. Default is `go run`.")
|
||||
(spacemacs|defc go-run-command "go run"
|
||||
"Go run command. Default is `go run`."
|
||||
'string nil #'stringp)
|
||||
|
||||
(defvar go-test-command "go test"
|
||||
"Go test command. Default is `go test`.")
|
||||
(spacemacs|defc go-test-command "go test"
|
||||
"Go test command. Default is `go test`."
|
||||
'string nil #'stringp)
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
(defun go/init-flycheck-golangci-lint ()
|
||||
(use-package flycheck-golangci-lint
|
||||
:defer t
|
||||
:init (add-hook 'go-mode-hook 'spacemacs//go-enable-flycheck-golangci-lint t)))
|
||||
:init (add-hook 'go-mode-local-vars-hook 'spacemacs//go-enable-flycheck-golangci-lint)))
|
||||
|
||||
(defun go/post-init-ggtags ()
|
||||
(add-hook 'go-mode-local-vars-hook #'spacemacs/ggtags-mode-enable))
|
||||
|
@ -81,7 +81,8 @@
|
|||
(spacemacs/helm-gtags-define-keys-for-mode 'go-mode))
|
||||
|
||||
(defun go/init-go-eldoc ()
|
||||
(use-package go-eldoc :defer t))
|
||||
(use-package go-eldoc
|
||||
:defer t))
|
||||
|
||||
(defun go/init-go-fill-struct ()
|
||||
(use-package go-fill-struct
|
||||
|
@ -128,16 +129,13 @@
|
|||
|
||||
(defun go/init-go-mode ()
|
||||
(use-package go-mode
|
||||
:hook (go-mode . spacemacs//go-set-tab-width)
|
||||
(go-mode-local-vars . spacemacs//go-setup-backend)
|
||||
(go-mode-local-vars . spacemacs//go-setup-format)
|
||||
:hook ((go-mode-local-vars . spacemacs//go-set-tab-width)
|
||||
(go-mode-local-vars . spacemacs//go-setup-backend)
|
||||
(go-mode-local-vars . spacemacs//go-setup-format))
|
||||
:init
|
||||
(progn
|
||||
;; get go packages much faster
|
||||
(setq go-packages-function 'spacemacs/go-packages-gopkgs)
|
||||
(dolist (value '(lsp go-mode))
|
||||
(add-to-list 'safe-local-variable-values
|
||||
(cons 'go-backend value)))
|
||||
(spacemacs|add-toggle go-test-verbose
|
||||
:documentation "Enable verbose test output."
|
||||
:status go-test-verbose
|
||||
|
|
Loading…
Reference in a new issue