Skip to content

Instantly share code, notes, and snippets.

@mboersma
Last active August 29, 2015 14:05
Show Gist options
  • Save mboersma/339e2a57b8ffea30b855 to your computer and use it in GitHub Desktop.
Save mboersma/339e2a57b8ffea30b855 to your computer and use it in GitHub Desktop.
Get "Go to Declaration" working in atom

For Mac OS X at least:

$ brew update && brew install ctags
$ alias ctags=/usr/local/Cellar/ctags/5.8/bin/ctags
$ cd $GOPATH/src/github.com/deis/deis
$ ctags -R .

Then in atom, type [Opt]+[Cmd]+[down arrow] when the cursor is on an identifier.

I found this info at atom/symbols-view#9

But ctags 5.8 doesn't understand Go! So edit ~/.ctags and add these lines:

--langdef=Go
--langmap=Go:.go
--regex-Go=/func([ \t]+\([^)]+\))?[ \t]+([a-zA-Z0-9_]+)/\2/f,func/
--regex-Go=/var[ \t]+([a-zA-Z_][a-zA-Z0-9_]+)/\1/v,var/
--regex-Go=/type[ \t]+([a-zA-Z_][a-zA-Z0-9_]+)/\1/t,type/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment