:lang go

The hipster dialect

1. 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 :editor (format +onsave))
  • Code navigation & refactoring (go-guru)
  • File templates
  • Snippets
  • Generate testing code (go-gen-test)
  • Code checking (flycheck-golangci-lint)

1.1. Maintainers

This module has no dedicated maintainers. Become a maintainer?

1.2. Module flags

Enable LSP support for go-mode. Requires :tools lsp and a langserver (supports gopls). It is highly recommended you use this, as the non-LSP experience is deprecated (and poor).

1.4. Hacks

No hacks documented for this module.

2. Prerequisites

2.1. Go

To get started with Go, you need go:

2.1.1. MacOS

$ brew install go

2.1.2. Arch Linux

$ pacman -S go

2.1.3. openSUSE

$ zypper install go

2.2. Dependencies

This module requires a valid $GOPATH, and the following Go packages:

  • 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 get -u github.com/x-motemen/gore/cmd/gore
$ go get -u github.com/stamblerre/gocode
$ go get -u golang.org/x/tools/cmd/godoc
$ go get -u golang.org/x/tools/cmd/goimports
$ go get -u golang.org/x/tools/cmd/gorename
$ go get -u golang.org/x/tools/cmd/guru
$ go get -u github.com/cweill/gotests/...
$ go get -u github.com/fatih/gomodifytags

It is recommended not to use go get to install golangci-lint. See its documentation for details.

3. TODO Usage

This module has no usage documentation yet. Write some?

4. TODO Configuration

This module has no configuration documentation yet. Write some?

5. Troubleshooting

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

6. TODO Appendix

This module has no appendix yet. Write one?