Skip to content

Commit

Permalink
fix(tool/imports): resolve dependency symlinks. (#303)
Browse files Browse the repository at this point in the history
The change in #302 only removed
symlinks from the directory path for `main.jsonnet`; this commit also
modifies the code that iteratoes through all the transitive dependencies
to de-symlink them.
  • Loading branch information
mplzik authored Jun 30, 2020
1 parent 9dfad80 commit 52a66f7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/jsonnet/imports.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,14 @@ func TransitiveImports(dir string) ([]string, error) {

paths := make([]string, 0, len(imports)+1)
for k := range imports {
paths = append(paths, k)

// Try to resolve any symlinks; use the original path as a last resort
p, err := filepath.EvalSymlinks(k)
if err != nil {
return nil, errors.Wrap(err, "resolving symlinks")
}
paths = append(paths, p)

}
paths = append(paths, mainFile)

Expand Down

0 comments on commit 52a66f7

Please sign in to comment.