mirror of
https://github.com/google/go-jsonnet.git
synced 2025-09-29 09:21:03 +02:00
A step towards a unified test suite. In particular this lets us use C++ version with Go tests. The problem remains that errors (both static and runtime) may differ between implementations. This will require special handling. C++ version seems to pass all "positive" tests. Go version also has this problem (error formatter used in tests is different). Also native functions etc. are not handled in any way at the moment.
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.6 and above.
Build instructions
export GOPATH=$HOME/go-workspace
mkdir -pv $GOPATH
go get github.com/google/go-jsonnet
cd $GOPATH/src/github.com/google/go-jsonnet
cd jsonnet
go build
./jsonnet /dev/stdin <<< '{x: 1, y: self.x} + {x: 10}'
{
"x": 10,
"y": 10
}
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
Generated Stdlib
To regenerate the standard library, do:
./reset_stdast_go.sh && go run cmd/dumpstdlibast.go
Description
Languages
Go
98.4%
Jsonnet
0.7%
Python
0.3%
C
0.3%
Starlark
0.2%