doomemacs/modules/lang/go
Henrik Lissner 09cb4f6716
Major refactor & optimization of how modules load their packages
Now that we are loading package autoloads files (as part of the
generated doom-package-autoload-file when running make autoloads), many
:commands properties are redundant. In fact, many def-package! blocks
are redundant.

In some cases, we can do without a config.el file entirely, and can move
into the autoloads file or rely entirely on package autoloads.

Also, many settings have been moved in their module's autoloads files,
which makes them available ASAP; their use no longer depends on module
load order.

This gained me a modest ~10% boost in startup speed.
2018-05-25 00:46:16 +02:00
..
autoload.el Rethink what Doom loads at startup and manually 2018-01-07 00:15:57 -05:00
config.el Major refactor & optimization of how modules load their packages 2018-05-25 00:46:16 +02:00
doctor.el Don't byte-compile doctor.el files 2018-03-20 21:19:37 -04:00
packages.el Refactor lang/go 2017-05-26 20:22:45 +02:00
README.org General & minor refactor+cleanup 2017-11-05 19:54:44 +01:00

:lang go

This module adds Go support.

  • Code completion (gocode)
  • Documentation lookup (godoc)
  • Eldoc support (go-eldoc)
  • REPL (gore)
  • Syntax-checking (flycheck)
  • Auto-formatting on save (gofmt)
  • Code navigation & refactoring (go-guru)
  • File templates
  • Snippets

I have mixed feelings about Go. It's a decent compromise between C and higher-level languages, is pleasantly straight-forward and elegant, but lacks native support for luxuries I miss from other languages, like generics, optional arguments, and function overloading. You've got to learn to love interface{}.

Still, Go is a remarkably useful (and fast!) companion for a variety of small-to-medium backend web and CLI projects.

Table of Contents   TOC

Install

Go

To get started with Go, you need the go tool:

MacOS

brew install go

Arch Linux

sudo pacman --needed --noconfirm -S go

Dependencies

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

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

go get -u github.com/motemen/gore
go get -u github.com/nsf/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