Go LSP Configuration

The details below describe how to install and configure the Go language server found here.
NOTE: This installation process assumes Go has been installed on the machine.

Installing the Language Server

To install the language server run the following command:
go get github.com/sourcegraph/go-langserver
With the software installed test the installation by running go-langserver.exe --help at the command line prompt, which should result in the following output:
Usage of go-langserver.exe:
  -addr string
    	server listen address (tcp) (default ":4389")
  -freeosmemory
    	aggressively free memory back to the OS (default true)
  -func-snippet-enabled
    	enable argument snippets on func completion. Can be overridden by InitializationOptions. (default true)
  -gocodecompletion
    	enable completion (extra memory burden). Can be overridden by InitializationOptions.
  -logfile string
    	also log to this file (in addition to stderr)
  -maxparallelism int
    	use at max N parallel goroutines to fulfill requests. Can be overridden by InitializationOptions.
  -mode string
    	communication mode (stdio|tcp) (default "stdio")
  -pprof string
    	start a pprof http server (https://golang.org/pkg/net/http/pprof/)
  -trace
    	print all requests and responses
  -usebinarypkgcache
    	use $GOPATH/pkg binary .a files (improves performance). Can be overridden by InitializationOptions. (default true)
  -version
    	print version and exit
If that output is not produced check the installation and also check to make sure the executuble installation folder has been added to the system PATH environment variable.

Configuration

Edit the Go document type and in the Language Server configuration panel apply the following configuration settings:
Program Type: Executable
     Program: go-langserver.exe
   Arguments: -mode=stdio
              -trace
              -gocodecompletion
NOTE: The executable directory option can be omitted provided the executable folder is found in the system PATH environment variable.

Using the Language Server

To test the configuration create a simple test.go file and fire off an auto-complete request:
lsp go
If the auto complete does not fire make sure the GOPATH is correctly configured and the test.go file folder location is in that path.


Latest Version: Zeus 3.98s
Released: 9th November 2018