Gopls LSP Configuration

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

Installing the Language Server

Run the following command to install the language server:
go install golang.org/x/tools/gopls@latest
After the command completes run the following command to check the installation:
gopls.exe version
That command should result in outpuit similar to the following:
golang.org/x/tools/gopls v0.14.2
    golang.org/x/tools/gopls@v0.14.2 h1:sIw6vjZiuQ9S7s0auUUkHlWgsCkKZFWDHmrge8LYsnc=
If that output is not produced the correct output check the installation and also check to make sure the executuble installation folder has been added to the system PATH environment variable.
Use the following command to locate the installation folder of the language server:
which gopls.exe
That command should result in output similar to the following:
C:\Go\bin\gopls.exe
Take note of that folder locate as it will be needed in the configuration steps that follow.

Configuration

Start Zeus and use the Options, Document Types menu to edit the Go document type and in the Language Server configuration panel apply the following configuration settings:
Program Type: Executable
     Program: C:\Go\bin\gopls.exe
NOTE: The executable details used are the same as the details noted from the earlier steps of the configuration process.

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.99b
Released: 29th January 2024