This is a sample project that demonstrates Pkl <> Go integration.
This is a basic HTTP server that is configured via Pkl in the pkl/
directory.
| Directory | Description |
|---|---|
|
Pkl configuration sources |
|
Generated Go sources from Pkl |
|
Internal Go files |
|
Server entrypoint |
|
Scripts directory |
To generate new Pkl sources for the AppConfig module, first install the Go code generator:
go install github.com/apple/pkl-go/cmd/pkl-gen-go@latestWith that installed, generate Go sources via:
pkl-gen-go pkl/AppConfig.pklThe code generator detects that the Go package for AppConfig is
github.com/apple/pkl-go-examples/gen/appconfig, and the Go module
name is github.com/apple/pkl-go-examples (via the go.mod file), and
therefore places generated sources in gen/appconfig.