Go to file
2018-02-25 13:41:11 -05:00
ast Add std.sign and fix division by zero in stdlib 2018-02-21 20:31:04 -05:00
cmd remove escLocalFS (#150) 2017-11-10 09:55:22 -05:00
compat Support of +:, in, in super 2017-09-28 22:21:46 -04:00
compat_test Some placeholders and experiments for C library 2017-09-27 22:01:29 -04:00
dump Fix unparsing of enums, avoid static type error 2017-11-08 11:28:38 -05:00
jsonnet Convert --tla/ext-*-file to imports 2018-01-30 18:22:29 -05:00
linter Very basic, experimental linter 2018-01-15 21:05:52 -05:00
parser Clean up token strings 2018-02-25 13:41:11 -05:00
std Add std.sign and fix division by zero in stdlib 2018-02-21 20:31:04 -05:00
testdata Add std.sign and fix division by zero in stdlib 2018-02-21 20:31:04 -05:00
.gitignore Very basic, experimental linter 2018-01-15 21:05:52 -05:00
.travis.yml Oldest version known to work = Go 1.8, closes #177 2018-01-18 12:48:20 -05:00
builtins.go Fast, native implementation of strReplace 2018-01-31 15:27:59 -05:00
CONTRIBUTING Add CONTRIBUTING, add newline to end of other files 2016-02-19 17:36:19 -05:00
desugarer_test.go First end-to-end test (addition of numbers) 2016-03-08 01:17:44 -05:00
desugarer.go Introduce a Parens AST (#189) 2018-02-16 13:01:14 -05:00
doc.go Remove go:generate causing errors 2017-09-29 12:36:04 -04:00
error_formatter.go jsonnet: fix docs, correct EvaluateSnippetMulti 2017-12-13 18:09:05 -05:00
evaluator.go Allow bitwise operations on floats, according to Spec (and Javascript behavior) 2017-10-26 20:26:16 -04:00
imports.go Fix processing the same file many times 2018-01-27 15:09:25 -05:00
interpreter_test.go First end-to-end test (addition of numbers) 2016-03-08 01:17:44 -05:00
interpreter.go Do not assume that import path is always a filesystem path (do not clean it up) 2018-02-17 16:34:54 -05:00
jsonnet_test.go Basic refactoring - towards shared e2e tests 2017-12-14 17:48:34 -05:00
LICENSE Add CONTRIBUTING, add newline to end of other files 2016-02-19 17:36:19 -05:00
main_test.go Basic support for running jsonnet command in tests (#167) 2018-01-10 21:27:44 -05:00
mutually_recursive_defaults.input Optional eval (#92) 2017-10-10 00:06:14 -04:00
README.md Oldest version known to work = Go 1.8, closes #177 2018-01-18 12:48:20 -05:00
reset_stdast_go.sh Fix unparsing of enums, avoid static type error 2017-11-08 11:28:38 -05:00
runtime_error.go Location, error formatting and stack trace improvements (#59) 2017-10-03 14:27:44 -04:00
static_analyzer_test.go Move AST to its own package 2017-08-25 00:30:56 -04:00
static_analyzer.go Sort FreeVariables slice (#148) 2017-11-09 08:55:36 -05:00
std.thisFile.jsonnet Optional eval (#92) 2017-10-10 00:06:14 -04:00
tests.sh tell tests which implementation we are using (#142) 2017-11-03 00:41:40 -04:00
thunks.go Make errors in native functions runtime errors 2017-12-18 10:22:21 -05:00
value.go Add missing check for array out of bounds 2018-01-17 15:26:31 -05:00
vm.go Remove unnecessary type alias 2018-01-12 14:26:54 -05:00

go-jsonnet

GoDoc Widget Travis Widget Coverage Status Widget

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.

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