back to home

nsf / gocode

An autocompletion daemon for the Go programming language

4,999 stars
656 forks
66 issues
GoEmacs LispPython

AI Architecture Analysis

This repository is indexed by RepoMind. By analyzing nsf/gocode in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.

Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.

Source files are only loaded when you start an analysis to optimize performance.

Embed this Badge

Showcase RepoMind's analysis directly in your repository's README.

[![Analyzed by RepoMind](https://img.shields.io/badge/Analyzed%20by-RepoMind-4F46E5?style=for-the-badge)](https://repomind.in/repo/nsf/gocode)
Preview:Analyzed by RepoMind

Repository Overview (README excerpt)

Crawler view

An autocompletion daemon for the Go programming language **IMPORTANT: This project is not maintained anymore, consider using https://pkg.go.dev/golang.org/x/tools/gopls, a tool which provides similar functionality and more, created and maintained by Go team.** Gocode is a helper tool which is intended to be integrated with your source code editor, like vim, neovim and emacs. It provides several advanced capabilities, which currently includes: • Context-sensitive autocompletion It is called *daemon*, because it uses client/server architecture for caching purposes. In particular, it makes autocompletions very fast. Typical autocompletion time with warm cache is 30ms, which is barely noticeable. Also watch the demo screencast. Setup • You should have a correctly installed Go compiler environment and your personal workspace ($GOPATH). If you have no idea what **$GOPATH** is, take a look here. Please make sure that your **$GOPATH/bin** is available in your **$PATH**. This is important, because most editors assume that **gocode** binary is available in one of the directories, specified by your **$PATH** environment variable. Otherwise manually copy the **gocode** binary from **$GOPATH/bin** to a location which is part of your **$PATH** after getting it in step 2. Do these steps only if you understand why you need to do them: • Then you need to get the appropriate version of the gocode, for 6g/8g/5g compiler you can do this: (-u flag for "update") Windows users should consider doing this instead: That way on the Windows OS gocode will be built as a GUI application and doing so solves hanging window issues with some of the editors. • Next steps are editor specific. See below. Vim setup Vim manual installation Note: As of go 1.5 there is no $GOROOT/misc/vim script. Suggested installation is via vim-go plugin. In order to install vim scripts, you need to fulfill the following steps: • Install official Go vim scripts from **$GOROOT/misc/vim**. If you did that already, proceed to the step 2. • Install gocode vim scripts. Usually it's enough to do the following: 2.1. **update.sh** script does the following: #!/bin/sh mkdir -p "$HOME/.vim/autoload" mkdir -p "$HOME/.vim/ftplugin/go" cp "${0%/*}/autoload/gocomplete.vim" "$HOME/.vim/autoload" cp "${0%/*}/ftplugin/go/gocomplete.vim" "$HOME/.vim/ftplugin/go" 2.2. Alternatively, you can create symlinks using symlink.sh script in order to avoid running update.sh after every gocode update. **symlink.sh** script does the following: #!/bin/sh cd "${0%/*}" ROOTDIR= mkdir -p "$HOME/.vim/autoload" mkdir -p "$HOME/.vim/ftplugin/go" ln -s "$ROOTDIR/autoload/gocomplete.vim" "$HOME/.vim/autoload/" ln -s "$ROOTDIR/ftplugin/go/gocomplete.vim" "$HOME/.vim/ftplugin/go/" • Make sure vim has filetype plugin enabled. Simply add that to your **.vimrc**: • Autocompletion should work now. Use for autocompletion (omnifunc autocompletion). Using Vundle in Vim Add the following line to your **.vimrc**: And then update your packages by running . Using vim-plug in Vim Add the following line to your **.vimrc**: And then update your packages by running . Other Alternatively take a look at the vundle/pathogen friendly repo: https://github.com/Blackrush/vim-gocode. Neovim setup Neovim manual installation Neovim users should also follow , except that you should goto in step 2, and remember that, the Neovim configuration file is . Using Vundle in Neovim Add the following line to your **init.vim**: And then update your packages by running . Using vim-plug in Neovim Add the following line to your **init.vim**: And then update your packages by running . Emacs setup In order to install emacs script, you need to fulfill the following steps: • Install auto-complete-mode • Copy **emacs/go-autocomplete.el** file from the gocode source distribution to a directory which is in your 'load-path' in emacs. • Add these lines to your **.emacs**: (require 'go-autocomplete) (require 'auto-complete-config) (ac-config-default) Also, there is an alternative plugin for emacs using company-mode. See for installation instructions. If you're a MacOSX user, you may find that script useful: https://github.com/purcell/exec-path-from-shell. It helps you with setting up the right environment variables as Go and gocode require it. By default it pulls the PATH, but don't forget to add the GOPATH as well, e.g.: Options You can change all available options using command. The config file uses json format and is usually stored somewhere in **~/.config/gocode** directory. On windows it's stored in the appropriate AppData folder. It's suggested to avoid modifying config file manually, do that using the command. lists all options and their values. shows the value of that *option*. sets the new *value* for that *option*. • *propose-builtins* A boolean option. If **true**, gocode will add built-in types, functions and constants to autocompletion proposals. Default: **false**. • *lib-path* A string option. Allows you to add search paths for packages. By default, gocode only searches **$GOPATH/pkg/$GOOS_$GOARCH** and **$GOROOT/pkg/$GOOS_$GOARCH** in terms of previously existed environment variables. Also you can specify multiple paths using ':' (colon) as a separator (on Windows use semicolon ';'). The paths specified by *lib-path* are prepended to the default ones. • *autobuild* A boolean option. If **true**, gocode will try to automatically build out-of-date packages when their source files are modified, in order to obtain the freshest autocomplete results for them. This feature is experimental. Default: **false**. • *force-debug-output* A string option. If is not empty, gocode will forcefully redirect the logging into that file. Also forces enabling of the debug mode on the server side. Default: "" (empty). • *package-lookup-mode* A string option. If **go**, use standard Go package lookup rules. If **gb**, use gb-specific lookup rules. See https:/…