We didn't set the environment (upvalues) for objects created as comprehensions - we set them for each field separately, but that meant missing the locals. |
||
---|---|---|
ast | ||
c-bindings | ||
c-bindings-tests | ||
cmd | ||
cpp-jsonnet@a1bcd6b9f0 | ||
dump | ||
linter | ||
parser | ||
testdata | ||
.gitignore | ||
.gitmodules | ||
.travis.yml | ||
builtins.go | ||
CONTRIBUTING | ||
desugarer_test.go | ||
desugarer.go | ||
doc.go | ||
error_formatter.go | ||
go.mod | ||
go.sum | ||
imports.go | ||
interpreter_test.go | ||
interpreter.go | ||
jsonnet_test.go | ||
key.json.enc | ||
LICENSE | ||
main_test.go | ||
mutually_recursive_defaults.input | ||
README.md | ||
release.sh | ||
reset_stdast_go.sh | ||
runtime_error.go | ||
static_analyzer_test.go | ||
static_analyzer.go | ||
std.thisFile.jsonnet | ||
tests.sh | ||
thunks.go | ||
travisBuild.sh | ||
value.go | ||
vm.go |
go-jsonnet
This an implementation of Jsonnet in pure Go. It is feature complete but is not as heavily exercised as the Jsonnet C++ implementation. Please try it out and give feedback.
This code is known to work on Go 1.8 and above. We recommend always using the newest stable release of Go.
Install instructions
go get github.com/google/go-jsonnet/cmd/jsonnet
Build instructions (go 1.11+)
git clone github.com/google/go-jsonnet
cd go-jsonnet
go build ./cmd/jsonnet
Build instructions (go 1.8 - 1.10)
go get -u github.com/google/go-jsonnet
cd $GOPATH/src/github.com/google/go-jsonnet
go get -u .
go build ./cmd/jsonnet
Running tests
./tests.sh # Also runs `go test ./...`
Implementation Notes
We are generating some helper classes on types by using http://clipperhouse.github.io/gen/. Do the following to regenerate these if necessary:
go get github.com/clipperhouse/gen
go get github.com/clipperhouse/set
export PATH=$PATH:$GOPATH/bin # If you haven't already
go generate
Updating and modifying the standard library
Standard library source code is kept in cpp-jsonnet
submodule,
because it is shared with Jsonnet C++
implementation.
For perfomance reasons we perform preprocessing on the standard library, so for the changes to be visible, regeneration is necessary:
./reset_stdast_go.sh && go run cmd/dumpstdlibast/dumpstdlibast.go
The above command recreates ast/stdast.go
which puts the desugared standard library into the right data structures, which lets us avoid the parsing overhead during execution.