gopls (pronounced "Go please") is the official Go language server developed by the Go team. It provides IDE features to any LSP-compatible editor.
Questions tagged [gopls]
31 questions
1
vote
0 answers
gopls in VSCode is showing "index out of range" BrokenImport errors for imports
I've been working on a Go project in VSCode and yesterday gopls in started showing errors like
could not import github.com/Azure/azure-sdk-for-go/sdk/storage/azblob (import failed for "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob": import…

Yonsken
- 11
- 2
1
vote
0 answers
VSCode error pop up: unable to connect gopls server error
i was facing an unexpected error on vscode when trying to use golang. It ask me to install gopls but unfortunately it failed at the end
enter image description here
Is there any solution to solve it?
To solve it without any issues

Tan Jason
- 11
- 1
1
vote
1 answer
How to get GoLand's flawless multi module support on VSCode (no go work)
When I open my multi module project in GoLand (Jetbrains) it works amazingly, with Implementations, Type Declarations and other useful IDE features working fine out of the box.
But when I open that same project in VSCode, I cannot get intellisense…

Alex
- 23
- 5
1
vote
0 answers
gopls: Message: no object found for ident ... Go Problem with methods on C Structs
Code Snip
package main
/*
#include
typedef struct Person {
char* name;
int age;
} Person;
*/
import "C"
import (
"fmt"
"unsafe"
)
func (p *C.Person) PrintName() {
name := C.GoString(p.name)
…

Ameer Hamza
- 11
- 1
1
vote
0 answers
`gopls` disagrees with `go test` on interface implementation
Consider the following code:
package ifaces
import (
"fmt"
"testing"
)
type IFace1 interface {
Do1()
}
type IFace2 interface {
Do2()
}
type Inner struct {
}
func (i *Inner) Do2() {
…

caxcaxcoatl
- 8,472
- 1
- 13
- 21
1
vote
1 answer
fatal error: 'dirent.h' file not found when trying to install gopls/Go tools via Visual Studio Code
I am trying to install the Go tools in Visual Studio Code and am getting the following error when installing gopls:
Tools environment: GOPATH=/Users/jal/go
Installing 1 tool at /Users/jal/go/bin in module mode.
gopls
Installing…

JAL
- 41,701
- 23
- 172
- 300
1
vote
0 answers
x/tools/gopls: cannot find package on linux
I'm running go version 1.10.4 on linux.
Specifically, I'm trying to install the YouCompleteMe plugin for VIM and get an error on gopls.
I have looked at similar stackoverflow & github issues with go.
https://github.com/golang/go/issues/36442
How to…

0xheartcode
- 11
- 3
1
vote
0 answers
Golang (Gopls) throws incompatibleAssign even if the expected type is correct
I am passing timeout declared as time.Duration to context.withTimeout. It should work, but I still get incompatibleAssign error. Any idea?
Why I am getting this error
var timeout time.Duration
cannot use timeout (variable of type time.Duration) as…

Aamir Maniar
- 11
- 2
0
votes
0 answers
why do i get this error when installing gopls in vscode?
when i try to install the necessary tools for the go extension in vscode gopls fails to install and i get this error:
Installing golang.org/x/tools/gopls@latest FAILED
{
"code": 1,
"killed": false,
"signal": null,
"cmd": "C:\\Program…
0
votes
0 answers
Go language server VSCode and workspaces
I am trying to open my project in VSCode but I get the following error
could not import github.com/gorilla/mux (current file is not included in a workspace module)compilerBrokenImport
The above error goes for every third party and internal packages…

Apostolos
- 7,763
- 17
- 80
- 150
0
votes
1 answer
Why do I get an error while installing gopls through VScode
I started learning Go and wanted to setup environment
enter image description here
It all started by installing an extension for VScode. Then I got this huge error:
Tools environment: GOPATH=C:\Users\DNS\go
Installing 1 tool at C:\Users\DNS\go\bin…

MorS
- 9
- 2
0
votes
0 answers
How to make gopls recognize external github imports
I recently started to work on a Go project.
When I use gopls with Coc, all external imports are not recognized such as "github.com/prometheus/client_golang/prometheus". It complains it could not find this module from neither $GOROOT and…

DutchBro
- 45
- 4
0
votes
0 answers
Filed download and install Go modules dlv & gopls in VSCode
When i run my Go code in VSCode i needed install some modules. All modules normal downloaded and installing but 2 moduled (dlv & gopls) filed.
Tools environment: GOPATH=/home/user/project
Installing 2 tools at /home/user/project/bin in module mode.
…

GoGoMan
- 21
- 1
-1
votes
1 answer
VS code Shows BrokenImport While importing a Package in golang?
i have an issue in VS code while importing a package.VS code shows could not find the Package in GOBIN or GOROOT.But the program runs fine.But the issue is when this Problem arise the intellisense stops working to make it work i need to manually…

topgiver
- 1
-1
votes
1 answer
vscode: No autocomplete for `f.Close()` on *File
Is there a reason, why vscode does not suggest to use f.Close()?
I have gopls installed, and yesterday autocomplete worked fine
Restarting vscode did not help.

guettli
- 25,042
- 81
- 346
- 663