mirror of https://github.com/golang/go.git
internal/lsp: warn users who have built gopls with go-diff v1.2.0
I considered having gopls not initialize at all, but VS Code Go intercepts those error messages and they get buried. We should probably fix that in VS Code Go, but for now just show a warning. Updates golang/go#45732 Change-Id: I214974e5a96231c96b1583af8ac245de03cea5d8 Reviewed-on: https://go-review.googlesource.com/c/tools/+/315852 Trust: Rebecca Stambler <rstambler@golang.org> Run-TryBot: Rebecca Stambler <rstambler@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
parent
def02638c3
commit
3e17c62e37
|
|
@ -96,7 +96,24 @@ func (s *Server) initialize(ctx context.Context, params *protocol.ParamInitializ
|
|||
}
|
||||
}
|
||||
|
||||
goplsVersion, err := json.Marshal(debug.VersionInfo())
|
||||
versionInfo := debug.VersionInfo()
|
||||
|
||||
// golang/go#45732: Warn users who've installed sergi/go-diff@v1.2.0, since
|
||||
// it will corrupt the formatting of their files.
|
||||
for _, dep := range versionInfo.Deps {
|
||||
if dep.Path == "github.com/sergi/go-diff" && dep.Version == "v1.2.0" {
|
||||
if err := s.eventuallyShowMessage(ctx, &protocol.ShowMessageParams{
|
||||
Message: `It looks like you have a bad gopls installation.
|
||||
Please reinstall gopls by running 'GO111MODULE=on go get golang.org/x/tools/gopls@latest'.
|
||||
See https://github.com/golang/go/issues/45732 for more information.`,
|
||||
Type: protocol.Error,
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
goplsVersion, err := json.Marshal(versionInfo)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue