60 lines
1.9 KiB
Org Mode
60 lines
1.9 KiB
Org Mode
#+TITLE: :lang go
|
|
|
|
This module adds [[https://golang.org][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~)
|
|
+ [[../../feature/file-templates/templates/go-mode][File templates]]
|
|
+ [[https://github.com/hlissner/emacs-snippets/tree/master/go-mode][Snippets]]
|
|
|
|
#+begin_quote
|
|
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.
|
|
#+end_quote
|
|
|
|
* Table of Contents :TOC:
|
|
- [[#install][Install]]
|
|
- [[#go][Go]]
|
|
- [[#dependencies][Dependencies]]
|
|
|
|
* Install
|
|
** Go
|
|
To get started with Go, you need the ~go~ tool:
|
|
|
|
*** MacOS
|
|
#+BEGIN_SRC sh :tangle (if (doom-system-os 'macos) "yes")
|
|
brew install go
|
|
#+END_SRC
|
|
|
|
*** Arch Linux
|
|
#+BEGIN_SRC sh :dir /sudo:: :tangle (if (doom-system-os 'arch) "yes")
|
|
sudo pacman --needed --noconfirm -S go
|
|
#+END_SRC
|
|
|
|
** 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)
|
|
|
|
#+BEGIN_SRC sh
|
|
export GOPATH=~/work/go
|
|
|
|
go get -u github.com/motemen/gore
|
|
go get -u github.com/mdempsky/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
|
|
#+END_SRC
|
|
|