Skip to content

Latest commit

 

History

History
141 lines (121 loc) · 6.34 KB

README.org

File metadata and controls

141 lines (121 loc) · 6.34 KB

:lang go

Description

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.

Packages

  • doom-package:company-go if doom-module::completion company (DEPRECATED)
  • doom-package:flycheck-golangci-lint if doom-module::checkers syntax
  • doom-package:go-eldoc
  • doom-package:go-gen-test
  • doom-package:go-guru
  • doom-package:go-mode
  • doom-package:gorepl-mode
  • doom-package:go-tag

Hacks

No hacks documented for this module.

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.

Usage

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

Keybinds

KeysDescription
<localleader> aAdd field tags to a struct
<localleader> dRemove field tags from a struct
<localleader> eEvaluate buffer or selection in the Go playground
<localleader> iGo to imports
<localleader> b crun $ go clean
<localleader> b brun $ go build
<localleader> b rrun $ go run .
<localleader> h .lookup symbol at point in godoc
<localleader> h ddescribe symbol at point
<localleader> h vlist free variables
<localleader> h ilist implements relations for package types
<localleader> h plist peers for channel
<localleader> h P“what does this point to”
<localleader> h rlist references to object
<localleader> h ewhich errors
<localleader> h wwhat query
<localleader> h cshow callers of function at point
<localleader> h Cshow callees of function at point
<localleader> t trerun last test
<localleader> t arun all tests in project
<localleader> t frun all tests in current file
<localleader> t srun single test at point
<localleader> t gGenerate tests for all exported or selected functions
<localleader> t GGenerate tests for all functions
<localleader> t eGenerate tests for all exported functions
<localleader> t b sgo test.bench single
<localleader> t b ago test.bench all
<localleader> r i asearch imports to add
<localleader> r i rreimove unused imports

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?

Appendix

🔨 This module has no appendix yet. Write one?