completion-at-point backend for go
use syntax classes instead of custom character list
Bumped version
restructured go-capf--exit-func



You can also use your local clone with git send-email.


This package provides a completion-at-point function to complete go code using gocode, offering context-base suggestions for functions, variables and types without having to save the buffer.

While go-capf doesn't require anything to be installed besides gocode as an external component (which can be installed with a simple go install ...), a better looking completion front-end in Emacs, such as ivy might be worth recommending.

#How to use

Using MELPA and use-package, a minimal but sufficient setup might look something like this:

(use-package go-capf
  :after go-mode
  (add-hook 'go-mode-hook
			(lambda ()
			  (add-hook 'completion-at-point-functions #'go-capf
						nil t))))

This will let completion-at-point know that it should try go-capf first when looking for completions, in go-mode buffers.

Also make sure that completion-at-point or complete-symbol is actually bound.


In vanilla Emacs:


With ivy:



  • After completing, no further text is added, although it might be useful to add () for functions or {} for structures.

Any further bugs or questions can be submitted to my public inbox.


go-capf.el is distributed under the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication license.