MCPcopy
hub / github.com/google/go-jsonnet / importData

Method importData

imports.go:125–138  ·  view source on GitHub ↗
(importedFrom, importedPath string)

Source from the content-addressed store, hash-verified

123}
124
125func (cache *importCache) importData(importedFrom, importedPath string) (contents Contents, foundAt string, err error) {
126 contents, foundAt, err = cache.importer.Import(importedFrom, importedPath)
127 if err != nil {
128 return Contents{}, "", err
129 }
130 if cached, importedBefore := cache.foundAtVerification[foundAt]; importedBefore {
131 if cached != contents {
132 panic(fmt.Sprintf("importer problem: a different instance of Contents returned when importing %#v again", foundAt))
133 }
134 } else {
135 cache.foundAtVerification[foundAt] = contents
136 }
137 return
138}
139
140func (cache *importCache) importAST(importedFrom, importedPath string) (ast.Node, string, error) {
141 contents, foundAt, err := cache.importData(importedFrom, importedPath)

Callers 5

importASTMethod · 0.95
importStringMethod · 0.95
importBinaryMethod · 0.95
ResolveImportMethod · 0.80
ImportDataMethod · 0.80

Calls 1

ImportMethod · 0.65

Tested by

no test coverage detected