gopls doesn't take into account private interface methods from std or third-party packages. It results in the absence of some build errors. For example, consider the following code:
--main.go--package main
import (
"go/ast""go/token"
)
funcmain() {
varaint// expected error: "a declared but not used"var_ ast.Expr=node{} // expected error: "cannot use node{} ... (missing exprNode method)"
}
typenodestruct{}
func (node) Pos() token.Pos { return0 }
func (node) End() token.Pos { return0 }
I expect to get 2 errors, but gopls reports only one:
$ go build main.go
# command-line-arguments
./main.go:9:6: a declared but not used
./main.go:10:19: cannot use node{} (value of type node) as type ast.Expr in variable declaration:
node does not implement ast.Expr (missing exprNode method)
$ gopls check main.go
/tmp/main.go:9:6-7: a declared but not used
The text was updated successfully, but these errors were encountered:
gopherbot
added
Tools
This label describes issues relating to any tools in the x/tools repository.
gopls
Issues related to the Go language server, gopls.
labels
Nov 25, 2022
v0.10.1
andmaster (f718365)
go1.19.2
gopls
doesn't take into account private interface methods from std or third-party packages. It results in the absence of some build errors. For example, consider the following code:I expect to get 2 errors, but
gopls
reports only one:The text was updated successfully, but these errors were encountered: