| // Copyright 2019 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| "golang.org/x/tools/internal/lsp/source" |
| "golang.org/x/tools/internal/span" |
| // nativeFileSystem implements FileSystem reading from the normal os file system. |
| type nativeFileSystem struct{} |
| func (nativeFileSystem) ReadFile(uri span.URI) *source.FileContent { |
| r := &source.FileContent{URI: uri} |
| filename, err := uri.Filename() |
| r.Data, r.Error = ioutil.ReadFile(filename) |
| r.Hash = hashContents(r.Data) |