mirror of
https://github.com/google/go-jsonnet.git
synced 2025-09-29 17:31:02 +02:00
Expose MemoryImporter data
Signed-off-by: Kuat Yessenov <kuat@google.com>
This commit is contained in:
parent
8f568c1115
commit
ec5b07c45a
@ -144,11 +144,11 @@ func (importer *FileImporter) Import(dir, importedPath string) *ImportedData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type MemoryImporter struct {
|
type MemoryImporter struct {
|
||||||
data map[string]string
|
Data map[string]string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (importer *MemoryImporter) Import(dir, importedPath string) *ImportedData {
|
func (importer *MemoryImporter) Import(dir, importedPath string) *ImportedData {
|
||||||
if content, ok := importer.data[importedPath]; ok {
|
if content, ok := importer.Data[importedPath]; ok {
|
||||||
return &ImportedData{content: content, foundHere: importedPath}
|
return &ImportedData{content: content, foundHere: importedPath}
|
||||||
}
|
}
|
||||||
return &ImportedData{err: fmt.Errorf("Import not available %v", importedPath)}
|
return &ImportedData{err: fmt.Errorf("Import not available %v", importedPath)}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user