doom-emacs/modules/lang/go
Henrik Lissner 743c31cc30
bump: :lang go
dominikh/go-mode.el@8dce1e3ba1 -> dominikh/go-mode.el@6f4ff9ef87
weijiangan/flycheck-golangci-lint@9def093e41 -> weijiangan/flycheck-golangci-lint@91c59b128a

- Fixes weijiangan/flycheck-golangci-lint#15: golangci-lint's renamed
  the --deadline option to --timeout. (#7833, #7834)

Close: #7833
Close: #7834
Ref: weijiangan/flycheck-golangci-lint#15
Co-authored-by: blez <blez@users.noreply.github.com>
Co-authored-by: samcrang <samcrang@users.noreply.github.com>
2024-05-21 17:17:16 +02:00
..
autoload.el docs(go): keybinds and command docstrings 2023-02-23 01:34:55 -05:00
config.el fix!(go): prefer upstream formatter config 2024-05-21 17:16:04 +02:00
doctor.el
packages.el bump: :lang go 2024-05-21 17:17:16 +02:00
README.org docs(*): replace all-the-icons with nerd-icons 2024-05-21 17:16:13 +02:00

:lang go

Description   unfold

This module adds Go support, with optional (but recommended) LSP support via gopls.

  • Code completion (gocode)
  • Documentation lookup (godoc)
  • Eldoc support (go-eldoc)
  • REPL (gore)
  • Syntax-checking (flycheck)
  • Auto-formatting on save (gofmt) (requires doom-module::editor format +onsave)
  • Code navigation & refactoring (go-guru)
  • File templates
  • Snippets
  • Generate testing code (go-gen-test)
  • Code checking (flycheck-golangci-lint)

Maintainers

This module needs a maintainer. Become a maintainer?

Module flags

+lsp
Enable LSP support for go-mode. Requires doom-module::tools lsp and a langserver (supports gopls). Highly recommended, as the non-LSP experience is deprecated (and poor).
+tree-sitter
Leverages tree-sitter for better syntax highlighting and structural text editing. Requires doom-module::tools tree-sitter.

Hacks

No hacks documented for this module.

TODO Changelog

This module does not have a changelog yet.

Installation

Enable this module in your doom! block.

This module requires Go, a valid $GOPATH, and a number of go packages, listed below.

Go

  • macOS: $ brew install go
  • Arch Linux: $ pacman -S go
  • openSUSE: $ zypper install go

Dependencies

  • gocode (for code completion & eldoc support)
  • godoc (for documentation lookup)
  • gorename (for extra refactoring commands)
  • gore (for the REPL)
  • guru (for code navigation & refactoring commands)
  • goimports (optional: for auto-formatting code on save & fixing imports)
  • gotests (for generate test code)
  • gomodifytags (for manipulating tags)
export GOPATH=~/work/go

go install github.com/x-motemen/gore/cmd/gore@latest
go install github.com/stamblerre/gocode@latest
go install golang.org/x/tools/cmd/godoc@latest
go install golang.org/x/tools/cmd/goimports@latest
go install golang.org/x/tools/cmd/gorename@latest
go install golang.org/x/tools/cmd/guru@latest
go install github.com/cweill/gotests/gotests@latest
go install github.com/fatih/gomodifytags@latest
  • golangci-lint (optional: for flycheck to integrate golangci-lint results) it is recommended to not use $ go get to install this one, check the documentation.

TODO Usage

󱌣 This module has no usage documentation yet. Write some?

Keybinds

Keys Description
<localleader> a Add field tags to a struct
<localleader> d Remove field tags from a struct
<localleader> e Evaluate buffer or selection in the Go playground
<localleader> i Go to imports
<localleader> b c run $ go clean
<localleader> b b run $ go build
<localleader> b r run $ go run .
<localleader> h . lookup symbol at point in godoc
<localleader> h d describe symbol at point
<localleader> h v list free variables
<localleader> h i list implements relations for package types
<localleader> h p list peers for channel
<localleader> h P "what does this point to"
<localleader> h r list references to object
<localleader> h e which errors
<localleader> h w what query
<localleader> h c show callers of function at point
<localleader> h C show callees of function at point
<localleader> t t rerun last test
<localleader> t a run all tests in project
<localleader> t f run all tests in current file
<localleader> t s run single test at point
<localleader> t g Generate tests for all exported or selected functions
<localleader> t G Generate tests for all functions
<localleader> t e Generate tests for all exported functions
<localleader> t b s go test.bench single
<localleader> t b a go test.bench all
<localleader> r i a search imports to add
<localleader> r i r reimove unused imports

TODO Configuration

󱌣 This module has no configuration documentation yet. Write some?

Troubleshooting

There are no known problems with this module. Report one?

Frequently asked questions

This module has no FAQs yet. Ask one?

TODO Appendix

󱌣 This module has no appendix yet. Write one?