MCPcopy Create free account
hub / github.com/docker/docker-language-server / ReadDocument

Function ReadDocument

internal/pkg/document/manager.go:84–90  ·  view source on GitHub ↗

Read the document from the given URI and return its contents. This default implementation of a ReadDocumentFunc only handles file: URIs and returns an error otherwise.

(u uri.URI)

Source from the content-addressed store, hash-verified

82// implementation of a ReadDocumentFunc only handles file: URIs and returns an
83// error otherwise.
84func ReadDocument(u uri.URI) (contents []byte, err error) {
85 fn, err := filename(u)
86 if err != nil {
87 return nil, err
88 }
89 return os.ReadFile(fn)
90}
91
92func filename(u uri.URI) (fn string, err error) {
93 defer func() {

Callers 1

TestReadDocumentFunction · 0.85

Calls 1

filenameFunction · 0.85

Tested by 1

TestReadDocumentFunction · 0.68