Skip to content

Commit

Permalink
feat(eval): handle fully qualified imports
Browse files Browse the repository at this point in the history
Now also supports github.com/sh0rez/docsonnet/doc-util

Fixes #4
  • Loading branch information
sh0rez committed Aug 17, 2020
1 parent 2f9dcb2 commit 3e17576
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pkg/docsonnet/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,16 @@ func newImporter(paths []string) (*importer, error) {
}, nil
}

var docUtilPaths = []string{
"doc-util/main.libsonnet",
"github.com/sh0rez/docsonnet/doc-util/main.libsonnet",
}

func (i *importer) Import(importedFrom, importedPath string) (contents jsonnet.Contents, foundAt string, err error) {
if importedPath == "doc-util/main.libsonnet" {
return i.util, "<internal>", nil
for _, p := range docUtilPaths {
if importedPath == p {
return i.util, "<internal>", nil
}
}

return i.fi.Import(importedFrom, importedPath)
Expand Down

0 comments on commit 3e17576

Please sign in to comment.