jsonnet icon indicating copy to clipboard operation
jsonnet copied to clipboard

Add `importbin` statement

Open anguslees opened this issue 3 years ago • 5 comments
trafficstars

Add importbin. Like importstr but returns an array of numbers (integers 0-255).

Note! This changes the JsonnetImportCallback function type signature, and requires modification to existing code that uses custom import callbacks. The included python bindings have been updated.

anguslees avatar Jan 30 '22 01:01 anguslees

Reviewers: It's been a long time since I last wrote C++ - please treat everything with suspicion.

Re the import callback change: We could add a new/additional binary-safe import callback, and fallback to the existing c-string import callback. That will keep existing code compatibility, but I think it will be worse overall, since we now have an importbin statement that will fail at runtime in some jsonnet environments without warning. Happy to re-implement this PR if we want to follow some other migration strategy.

Edit: Oh, and I haven't actually tested/executed the python change at all, since that required bazel, and I was kind of hoping a github action/magic-ci-bot would do that for me (but no?).

anguslees avatar Jan 30 '22 01:01 anguslees

Hi, sorry for pinging like this on this PR

I am using a version of kubecfg with go-jsonnet from master so that i can use importbin ( and it is working as expected ) but this is of course breaking any jsonnet and jsonnetfmt command i run since support for importbin is not merged in it yet.

Is there any ETA / plan to merge this ?

thanks again

primeroz avatar Jul 06 '22 15:07 primeroz

What's the status exactly? If it's in go-jsonnet already then you can use jsonnet and jsonnetfmt from there.

sparkprime avatar Jul 06 '22 16:07 sparkprime

I did not know there was a jsonnetfmt from there i will try that

primeroz avatar Jul 06 '22 16:07 primeroz

Having said that, I am in favour of getting this PR in :)

sparkprime avatar Jul 06 '22 17:07 sparkprime