Files
doomemacs/modules/lang/go/config.el
Henrik Lissner 417f3bc892 refactor!(go): remove go-eldoc & company-go
BREAKING CHANGE: This removes company and non-LSP integration from the
Go module, in order to reduce the complexity of the module, reduce
dependencies on Company, and lean more on LSP, which provides these
features with more reliability and consistency. Switch to :tools lsp and
install a Go LSP client to get these features back.
2025-04-01 17:58:13 -04:00

57 lines
1.7 KiB
EmacsLisp

;;; lang/go/config.el -*- lexical-binding: t; -*-
;;
;;; Packages
(after! go-mode
(set-docsets! 'go-mode "Go")
(set-repl-handler! 'go-mode #'gorepl-run)
(set-lookup-handlers! 'go-mode
:documentation #'godoc-at-point)
(when (modulep! +lsp)
(add-hook 'go-mode-local-vars-hook #'lsp! 'append))
(when (modulep! +tree-sitter)
(add-hook 'go-mode-local-vars-hook #'tree-sitter! 'append))
(map! :map go-mode-map
:localleader
"a" #'go-tag-add
"d" #'go-tag-remove
"e" #'+go/play-buffer-or-region
"i" #'go-goto-imports ; Go to imports
(:prefix ("h" . "help")
"." #'godoc-at-point) ; Lookup in godoc
(:prefix ("ri" . "imports")
"a" #'go-import-add)
(:prefix ("b" . "build")
:desc "go run ." "r" (cmd! (compile "go run ."))
:desc "go build" "b" (cmd! (compile "go build"))
:desc "go clean" "c" (cmd! (compile "go clean")))
(:prefix ("g" . "generate")
"f" #'+go/generate-file
"d" #'+go/generate-dir
"a" #'+go/generate-all)
(:prefix ("t" . "test")
"t" #'+go/test-rerun
"a" #'+go/test-all
"s" #'+go/test-single
"n" #'+go/test-nested
"f" #'+go/test-file
"g" #'go-gen-test-dwim
"G" #'go-gen-test-all
"e" #'go-gen-test-exported
(:prefix ("b" . "bench")
"s" #'+go/bench-single
"a" #'+go/bench-all))))
(use-package! gorepl-mode
:commands gorepl-run-load-current-file)
(use-package! flycheck-golangci-lint
:when (modulep! :checkers syntax -flymake)
:hook (go-mode . flycheck-golangci-lint-setup))