1
0
mirror of https://github.com/golang/go synced 2024-11-18 15:04:44 -07:00

internal/lsp: fix panic in computing file version

Fixes golang/go#32791

Change-Id: I04fc3de5ed94137424a32f3e7200ba72d3913329
Reviewed-on: https://go-review.googlesource.com/c/tools/+/183984
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
This commit is contained in:
Rebecca Stambler 2019-06-26 15:24:04 -04:00
parent cf32dd832e
commit cd2ed857af

View File

@ -23,12 +23,10 @@ type nativeFileHandle struct {
}
func (fs *nativeFileSystem) GetFile(uri span.URI) source.FileHandle {
var version string
fi, err := os.Stat(uri.Filename())
if err != nil {
version = "DOES NOT EXIST"
version := "DOES NOT EXIST"
if fi, err := os.Stat(uri.Filename()); err == nil {
version = fi.ModTime().String()
}
version = fi.ModTime().String()
return &nativeFileHandle{
fs: fs,
identity: source.FileIdentity{