google / google/go-jsonnet

go-jsonnet reports static errors in tla-codes imports differently to c++

Open
#391 10 comments 0 reactions 0 assignees View on GitHub
error reporting
Dominant language
Go
Stars
1.8k
Forks
263
PR merge metrics
No merged PRs in 30d

Description

Suppose I have a top-level function which takes an arg (trivial function used here for simplicity):
```
function(foo) foo
```
Now suppose I specify a top-level arg using tla-code that imports some other file:
`--tla-code 'foo=import "foo.jsonnet"'`

However, that file contains a syntax error:
```
$ cat foo.jsonnet
not valid
```

Here is the result of running this with c++ jsonnet:
```
$ jsonnet --tla-code foo='import "foo.jsonnet"' -e 'function(foo) foo'
STATIC ERROR: foo.jsonnet:1:5-10: did not expect: (IDENTIFIER, "valid")
```
Here is the result with go-jsonnet:
```
$ go-jsonnet --tla-code foo='import "foo.jsonnet"' -e 'function(foo) foo'
RUNTIME ERROR: foo.jsonnet:1:5-10 Did not expect: (IDENTIFIER, "valid")
:1:1-21 $
:1:15-18 function
Top-level function
```

The same behaviour occurs if you replace `--tla-code foo='import "foo.jsonnet"'` with `--tla-code-file foo=foo.jsonnet`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.