jrsonnet icon indicating copy to clipboard operation
jrsonnet copied to clipboard

import pathing doesn't match go-jsonnet

Open jregehr opened this issue 2 years ago • 4 comments

Within a jsonnet or libsonnet file, the import command seems to operate from the directory where jrsonnet was invoked. The LIbrary search dirs (either -J or JSONNET_PATH) weren't respected either.

In general, the import functionality doesn't match the go-jsonnet implementation.

jregehr avatar May 10 '23 15:05 jregehr

Is it?

out
├── a.jsonnet
├── b.jsonnet
└── library
    └── c.jsonnet

a.jsonnet:

import 'b.jsonnet'

b.jsonnet:

import 'c.jsonnet'

c.jsonnet:

1 + 2

Running jrsonnet out/a.jsonnet -J out/library yields 3. So import operates on paths relative to calling file, and library paths are respected.

Do you have concrete examples where it behaves wrong? Is this problem in jrsonnet itself, or in the project, which is using jrsonnet as a library? Which version of jrsonnet do you use?

CertainLach avatar May 10 '23 15:05 CertainLach

I'll try to work up a concrete example. I have a pretty extensive jSonnet project and my jsonnet invocations also have two library paths. When I run my generate script with go-jsonnet it works; with jrsonnet it fails.

I like the idea of faster runtimes for jrsonnet vs. jsonnet.

jregehr avatar May 11 '23 03:05 jregehr

Don't you have symlinks lying around, by any chance?

CertainLach avatar Oct 01 '23 10:10 CertainLach

@CertainLach could you clarify your question? Are you asking if I have symlinks in use in my jsonnet libraries? I didn't up until this week. I do have them now but I did not have them when I opened the issue.

jregehr avatar Oct 06 '23 11:10 jregehr