diff --git a/modules/lang/go/README.org b/modules/lang/go/README.org index c1a2f91e7..df0dbf48a 100644 --- a/modules/lang/go/README.org +++ b/modules/lang/go/README.org @@ -27,6 +27,7 @@ This module adds [[https://golang.org][Go]] support. + [[../../editor/file-templates/templates/go-mode][File templates]] + [[https://github.com/hlissner/doom-snippets/tree/master/go-mode][Snippets]] + Generate testing code (~go-gen-test~) ++ Code checking (~flycheck-golangci-lint~) ** Module Flags + =+lsp= Enables integration for the gopls LSP server. @@ -39,6 +40,7 @@ This module adds [[https://golang.org][Go]] support. + [[https://github.com/brantou/emacs-go-tag][go-tag]] + [[https://github.com/mdempsky/gocode][company-go]]* + [[https://github.com/s-kostyaev/go-gen-test][go-gen-test]] ++ [[https://github.com/weijiangan/flycheck-golangci-lint][flycheck-golangci-lint]] (if =:tools flycheck= is enabled) * Prerequisites ** Go @@ -84,6 +86,10 @@ go get -u github.com/cweill/gotests/... go get -u github.com/fatih/gomodifytags #+END_SRC ++ ~golangci-lint~ (optional: for flycheck to integrate golangci-lint results) + it is recommended to *not* use go get to install this one, check the + [[https://github.com/golangci/golangci-lint#binary-release][documentation]]. + * TODO Features * TODO Configuration diff --git a/modules/lang/go/config.el b/modules/lang/go/config.el index 2f656f590..a19bfde14 100644 --- a/modules/lang/go/config.el +++ b/modules/lang/go/config.el @@ -69,3 +69,8 @@ :config (set-company-backend! 'go-mode 'company-go) (setq company-go-show-annotation t)) + +(use-package! flycheck-golangci-lint + :when (featurep! :tools flycheck) + :hook (go-mode . flycheck-golangci-lint-setup) + :config (setenv "GO111MODULE" "on")) diff --git a/modules/lang/go/packages.el b/modules/lang/go/packages.el index ab3c2b8c1..64a72ea6b 100644 --- a/modules/lang/go/packages.el +++ b/modules/lang/go/packages.el @@ -10,3 +10,6 @@ (when (featurep! :completion company) (package! company-go)) + +(when (featurep! :tools flycheck) + (package! flycheck-golangci-lint))