Add golangci-lint support
This commit is contained in:
parent
c2e377c902
commit
1d49cd7ed8
|
@ -28,6 +28,9 @@
|
|||
(defvar go-use-gometalinter nil
|
||||
"Use gometalinter if the variable has non-nil value.")
|
||||
|
||||
(defvar go-use-golangci-lint nil
|
||||
"Use golangci-lint if the variable has non-nil value.")
|
||||
|
||||
(defvar go-test-buffer-name "*go test*"
|
||||
"Name of the buffer for go test output. Default is *go test*.")
|
||||
|
||||
|
|
|
@ -64,6 +64,16 @@
|
|||
go-errcheck))
|
||||
(flycheck-gometalinter-setup))
|
||||
|
||||
(defun spacemacs//go-enable-golangci-lint ()
|
||||
"Enable `flycheck-golangci-lint' and disable overlapping `flycheck' linters."
|
||||
(setq flycheck-disabled-checkers '(go-gofmt
|
||||
go-golint
|
||||
go-vet
|
||||
go-build
|
||||
go-test
|
||||
go-errcheck))
|
||||
(flycheck-golangci-lint-setup))
|
||||
|
||||
(defun spacemacs/go-run-tests (args)
|
||||
(interactive)
|
||||
(compilation-start (concat "go test " args " " go-use-test-args)
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
(flycheck-gometalinter :toggle (and go-use-gometalinter
|
||||
(configuration-layer/package-used-p
|
||||
'flycheck)))
|
||||
(flycheck-golangci-lint :toggle (and go-use-golangci-lint
|
||||
(configuration-layer/package-used-p
|
||||
'flycheck)))
|
||||
ggtags
|
||||
helm-gtags
|
||||
go-eldoc
|
||||
|
@ -62,6 +65,11 @@
|
|||
:defer t
|
||||
:init (add-hook 'go-mode-hook 'spacemacs//go-enable-gometalinter t)))
|
||||
|
||||
(defun go/init-flycheck-golangci-lint ()
|
||||
(use-package flycheck-golangci-lint
|
||||
:defer t
|
||||
:init (add-hook 'go-mode-hook 'spacemacs//go-enable-golangci-lint t)))
|
||||
|
||||
(defun go/post-init-ggtags ()
|
||||
(add-hook 'go-mode-local-vars-hook #'spacemacs/ggtags-mode-enable))
|
||||
|
||||
|
|
Loading…
Reference in a new issue