Skip to content

Commit 9ed2795

Browse files
authored
Adopt go tool for running pkl-gen-go, update dependencies (#11)
1 parent e5cddf8 commit 9ed2795

File tree

18 files changed

+217
-231
lines changed

18 files changed

+217
-231
lines changed

.circleci/config.pkl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs {
3131
["test"] {
3232
docker {
3333
new {
34-
image = "cimg/go:1.23"
34+
image = "cimg/go:1.25"
3535
}
3636
}
3737
steps {
@@ -41,9 +41,8 @@ jobs {
4141
command = """
4242
mkdir -p /tmp/bin
4343
export PATH=$PATH:/tmp/bin
44-
curl -L -o /tmp/bin/pkl https://github.com/apple/pkl/releases/download/0.29.0/pkl-linux-amd64
44+
curl -L -o /tmp/bin/pkl https://github.com/apple/pkl/releases/download/0.29.1/pkl-linux-amd64
4545
chmod +x /tmp/bin/pkl
46-
go install github.com/apple/pkl-go/cmd/pkl-gen-go@latest
4746
go list -f '{{.Dir}}/...' -m | xargs go generate
4847
go list -f '{{.Dir}}/...' -m | xargs go test
4948
"""

.circleci/config.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@ jobs:
1010
command: |-
1111
mkdir -p /tmp/bin
1212
export PATH=$PATH:/tmp/bin
13-
curl -L -o /tmp/bin/pkl https://github.com/apple/pkl/releases/download/0.29.0/pkl-linux-amd64
13+
curl -L -o /tmp/bin/pkl https://github.com/apple/pkl/releases/download/0.29.1/pkl-linux-amd64
1414
chmod +x /tmp/bin/pkl
15-
go install github.com/apple/pkl-go/cmd/pkl-gen-go@latest
1615
go list -f '{{.Dir}}/...' -m | xargs go generate
1716
go list -f '{{.Dir}}/...' -m | xargs go test
1817
name: test
1918
docker:
20-
- image: cimg/go:1.23
19+
- image: cimg/go:1.25
2120
workflows:
2221
prb:
2322
jobs:

README.adoc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,10 @@
22

33
Ready-go-to examples that demonstrate using Pkl with Go applications.
44

5-
* link:./simple[Simple Example]
6-
* link:./buildtimeeval[Build Time Evaluation Example]
5+
* link:./simple[Simple Example] illustrates a basic web service that uses Pkl to drive configuration.
6+
* link:./buildtimeeval[Build Time Evaluation Example] is similar to the simple example but moves Pkl evaluation from run time to build time.
7+
8+
=== Requirements
9+
10+
* Go >1.25
11+
* Pkl >0.29.1

README.md

Lines changed: 0 additions & 39 deletions
This file was deleted.

buildtimeeval/PklProject

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
amends "pkl:Project"
22

33
dependencies {
4-
["go"] { uri = "package://pkg.pkl-lang.org/pkl-go/[email protected].0" }
4+
["go"] { uri = "package://pkg.pkl-lang.org/pkl-go/[email protected].1" }
55
}

buildtimeeval/PklProject.deps.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
"resolvedDependencies": {
44
"package://pkg.pkl-lang.org/pkl-go/pkl.golang@0": {
55
"type": "remote",
6-
"uri": "projectpackage://pkg.pkl-lang.org/pkl-go/[email protected].0",
6+
"uri": "projectpackage://pkg.pkl-lang.org/pkl-go/[email protected].1",
77
"checksums": {
8-
"sha256": "cc351272251f7d0c93cd93de413f49898effcc432d832135ee9412dda39aea89"
8+
"sha256": "8116c0ad12a9b7284642871dd698c6ff70d018cb1bfe77b4d1fb7871781e73bf"
99
}
1010
}
1111
}

buildtimeeval/README.adoc

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,11 @@ This approach is not feasible if:
3131

3232
== Codegen
3333

34-
To generate new Pkl sources for the AppConfig module, first install the
35-
Go code generator:
34+
To generate new Pkl sources for the AppConfig module, run:
3635

3736
[source,bash]
3837
----
39-
go install github.com/apple/pkl-go/cmd/pkl-gen-go@latest
40-
----
41-
42-
With that installed, generate Go sources via:
43-
44-
[source,bash]
45-
----
46-
pkl-gen-go pkl/AppConfig.pkl
38+
go tool pkl-gen-go pkl/AppConfig.pkl
4739
----
4840

4941
The code generator detects that the Go package for `AppConfig` is

buildtimeeval/generate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
// limitations under the License.
1515
// ===----------------------------------------------------------------------===//
1616

17-
//go:generate pkl-gen-go pkl/AppConfig.pkl
17+
//go:generate go tool pkl-gen-go pkl/AppConfig.pkl
1818
//go:generate go run cmd/internal/generate-pkl-data/main.go
1919
package buildtimeeval

buildtimeeval/go.mod

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,52 @@ module github.com/apple/pkl-go-examples/buildtimeeval
22

33
go 1.23.7
44

5-
toolchain go1.23.11
5+
toolchain go1.25.0
66

77
require (
8-
github.com/apple/pkl-go v0.11.0
9-
github.com/gin-gonic/gin v1.10.0
8+
github.com/apple/pkl-go v0.11.1
9+
github.com/gin-gonic/gin v1.10.1
1010
github.com/go-redis/redis/v8 v8.11.5
11-
github.com/stretchr/testify v1.10.0
11+
github.com/stretchr/testify v1.11.1
1212
)
1313

1414
require (
15-
github.com/bytedance/sonic v1.11.6 // indirect
16-
github.com/bytedance/sonic/loader v0.1.1 // indirect
17-
github.com/cespare/xxhash/v2 v2.2.0 // indirect
18-
github.com/cloudwego/base64x v0.1.4 // indirect
19-
github.com/cloudwego/iasm v0.2.0 // indirect
15+
github.com/bytedance/sonic v1.14.0 // indirect
16+
github.com/bytedance/sonic/loader v0.3.0 // indirect
17+
github.com/cespare/xxhash/v2 v2.3.0 // indirect
18+
github.com/cloudwego/base64x v0.1.6 // indirect
2019
github.com/davecgh/go-spew v1.1.1 // indirect
2120
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
22-
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
23-
github.com/gin-contrib/sse v0.1.0 // indirect
21+
github.com/gabriel-vasile/mimetype v1.4.10 // indirect
22+
github.com/gin-contrib/sse v1.1.0 // indirect
2423
github.com/go-playground/locales v0.14.1 // indirect
2524
github.com/go-playground/universal-translator v0.18.1 // indirect
26-
github.com/go-playground/validator/v10 v10.20.0 // indirect
27-
github.com/goccy/go-json v0.10.2 // indirect
25+
github.com/go-playground/validator/v10 v10.27.0 // indirect
26+
github.com/goccy/go-json v0.10.5 // indirect
27+
github.com/google/go-cmp v0.7.0 // indirect
28+
github.com/inconshreveable/mousetrap v1.1.0 // indirect
2829
github.com/json-iterator/go v1.1.12 // indirect
29-
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
30+
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
3031
github.com/leodido/go-urn v1.4.0 // indirect
3132
github.com/mattn/go-isatty v0.0.20 // indirect
3233
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
3334
github.com/modern-go/reflect2 v1.0.2 // indirect
34-
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
35+
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
3536
github.com/pmezard/go-difflib v1.0.0 // indirect
37+
github.com/spf13/cobra v1.8.0 // indirect
38+
github.com/spf13/pflag v1.0.5 // indirect
3639
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
37-
github.com/ugorji/go/codec v1.2.12 // indirect
40+
github.com/ugorji/go/codec v1.3.0 // indirect
3841
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
3942
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
40-
golang.org/x/arch v0.8.0 // indirect
41-
golang.org/x/crypto v0.23.0 // indirect
42-
golang.org/x/net v0.25.0 // indirect
43-
golang.org/x/sys v0.20.0 // indirect
44-
golang.org/x/text v0.15.0 // indirect
45-
google.golang.org/protobuf v1.34.1 // indirect
43+
golang.org/x/arch v0.20.0 // indirect
44+
golang.org/x/crypto v0.41.0 // indirect
45+
golang.org/x/mod v0.26.0 // indirect
46+
golang.org/x/net v0.43.0 // indirect
47+
golang.org/x/sys v0.35.0 // indirect
48+
golang.org/x/text v0.28.0 // indirect
49+
google.golang.org/protobuf v1.36.8 // indirect
4650
gopkg.in/yaml.v3 v3.0.1 // indirect
4751
)
52+
53+
tool github.com/apple/pkl-go/cmd/pkl-gen-go

0 commit comments

Comments
 (0)