File tree 10 files changed +96
-5
lines changed
10 files changed +96
-5
lines changed Original file line number Diff line number Diff line change 1
1
cpp-jsonnet
2
+ examples/bazel
Original file line number Diff line number Diff line change @@ -8,11 +8,7 @@ coverage.out
8
8
build /
9
9
dist /
10
10
gojsonnet.egg-info /
11
- /bazel-bin
12
- /bazel-genfiles
13
- /bazel-go-jsonnet
14
- /bazel-out
15
- /bazel-testlogs
11
+ bazel- *
16
12
/dumpstdlibast
17
13
18
14
# built binaries
Original file line number Diff line number Diff line change
1
+ common --lockfile_mode=off
Original file line number Diff line number Diff line change
1
+ MODULE.bazel.lock
Original file line number Diff line number Diff line change
1
+ load ("@gazelle//:def.bzl" , "gazelle" )
2
+ load ("@rules_go//go:def.bzl" , "go_binary" , "go_library" )
3
+
4
+ gazelle (name = "gazelle" )
5
+
6
+ go_library (
7
+ name = "use_go_jsonnet_lib" ,
8
+ srcs = ["use_go_jsonnet.go" ],
9
+ importpath = "github.com/google/go-jsonnet/examples/bazel" ,
10
+ visibility = ["//visibility:private" ],
11
+ deps = ["@com_github_google_go_jsonnet//:go_default_library" ],
12
+ )
13
+
14
+ go_binary (
15
+ name = "use_go_jsonnet" ,
16
+ embed = [":use_go_jsonnet_lib" ],
17
+ visibility = ["//visibility:public" ],
18
+ )
Original file line number Diff line number Diff line change
1
+ bazel_dep (name = "gazelle" , version = "0.42.0" )
2
+ bazel_dep (name = "rules_go" , version = "0.53.0" )
3
+ bazel_dep (name = "jsonnet_go" )
4
+ local_path_override (
5
+ module_name = "jsonnet_go" ,
6
+ path = "../.." ,
7
+ )
8
+
9
+ go_sdk = use_extension ("@rules_go//go:extensions.bzl" , "go_sdk" )
10
+ go_sdk .download (version = "1.23.7" )
11
+
12
+ go_deps = use_extension ("@gazelle//:extensions.bzl" , "go_deps" )
13
+ go_deps .from_file (go_mod = "//:go.mod" )
14
+ use_repo (
15
+ go_deps ,
16
+ "com_github_google_go_jsonnet" ,
17
+ )
18
+
19
+ override_repo (
20
+ go_deps ,
21
+ com_github_google_go_jsonnet = "jsonnet_go" ,
22
+ )
Original file line number Diff line number Diff line change
1
+ local Person(name='Alice' ) = {
2
+ name: name,
3
+ welcome: 'Hello ' + name + '!' ,
4
+ };
5
+ {
6
+ person1: Person(),
7
+ person2: Person('Bob' ),
8
+ }
Original file line number Diff line number Diff line change
1
+ module example/go-jsonnet-using-bazel
2
+
3
+ go 1.23.7
4
+
5
+ require github.com/google/go-jsonnet v0.21.0-rc2
6
+
7
+ require (
8
+ golang.org/x/crypto v0.36.0 // indirect
9
+ golang.org/x/sys v0.31.0 // indirect
10
+ sigs.k8s.io/yaml v1.4.0 // indirect
11
+ )
12
+
13
+ replace github.com/google/go-jsonnet => ../../
Original file line number Diff line number Diff line change
1
+ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38 =
2
+ github.com/google/go-cmp v0.5.9 /go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY =
3
+ github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8 =
4
+ github.com/sergi/go-diff v1.3.1 /go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I =
5
+ golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34 =
6
+ golang.org/x/crypto v0.36.0 /go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc =
7
+ golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik =
8
+ golang.org/x/sys v0.31.0 /go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k =
9
+ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM =
10
+ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 /go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0 =
11
+ sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E =
12
+ sigs.k8s.io/yaml v1.4.0 /go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY =
Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "fmt"
5
+
6
+ gjs "github.com/google/go-jsonnet"
7
+ )
8
+
9
+ func main () {
10
+ fmt .Printf ("Example using go jsonnet (%s)\n " , gjs .Version ())
11
+
12
+ vm := gjs .MakeVM ()
13
+ out , err := vm .EvaluateFile ("example.jsonnet" )
14
+ if err != nil {
15
+ fmt .Printf ("%v\n " , err )
16
+ } else {
17
+ fmt .Printf ("%s" , out )
18
+ }
19
+ }
You can’t perform that action at this time.
0 commit comments