当VSCode试图安装golang.org/x/tools/gopls时,它抛出了下面的错误。
get "golang.org/x/tools": found meta tag get.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at https://golang.org/x/tools?go-get=1
go: finding golang.org/x/tools v0.0.0-20191108194844-46f05828f2fe
go: downloading golang.org/x/tools/gopls v0.2.0
golang.org/x/tools/internal/lsp/source
# golang.org/x/tools/internal/lsp/source
../../../pkg/mod/golang.org/x/tools@v0.0.0-20200407041343-bf15fae40dea/internal/lsp/source/completion.go:697:21: file.LineStart undefined (type *token.File has no field or method LineStart)
../../../pkg/mod/golang.org/x/tools@v0.0.0-20200407041343-bf15fae40dea/internal/lsp/source/format.go:246:27: fset.File(f.Pos()).LineStart undefined (type *token.File has no field or method LineStart)
../../../pkg/mod/golang.org/x/tools@v0.0.0-20200407041343-bf15fae40dea/internal/lsp/source/format.go:271:13: tok.LineStart undefined (type *token.File has no field or method LineStart)发布于 2020-05-12 01:23:43
在尝试使用YouCompleteMe为VIM构建完成时也遇到了同样的问题:
# golang.org/x/tools/internal/lsp/source
third_party/go/pkg/mod/golang.org/x/tools@v0.0.0-20200407041343-bf15fae40dea/internal/lsp/source/completion.go:697:21: file.LineStart undefined (type *token.File has no field or method LineStart)
third_party/go/pkg/mod/golang.org/x/tools@v0.0.0-20200407041343-bf15fae40dea/internal/lsp/source/format.go:246:27: fset.File(f.Pos()).LineStart undefined (type *token.File has no field or method LineStart)
third_party/go/pkg/mod/golang.org/x/tools@v0.0.0-20200407041343-bf15fae40dea/internal/lsp/source/format.go:271:13: tok.LineStart undefined (type *token.File has no field or method LineStart)解决方案:
从go 1.11.4切换到1.12beta1似乎已经解决了这个问题!
https://stackoverflow.com/questions/61262631
复制相似问题