├── .gitignore ├── go.work ├── .github ├── dependabot.yml ├── workflows │ ├── __lockfile__.yml │ ├── main.yml │ ├── build.yml │ └── prb.yml ├── PklProject ├── PklProject.deps.json └── index.pkl ├── simple ├── gen │ ├── appconfig │ │ ├── init.pkl.go │ │ ├── loglevel │ │ │ └── LogLevel.pkl.go │ │ └── AppConfig.pkl.go │ └── redisconfig │ │ ├── Auth.pkl.go │ │ ├── init.pkl.go │ │ └── RedisConfig.pkl.go ├── PklProject.deps.json ├── generate.go ├── README.adoc ├── PklProject ├── pkl │ ├── dev │ │ └── config.pkl │ ├── RedisConfig.pkl │ └── AppConfig.pkl ├── internal │ ├── config_test.go │ ├── routes.go │ ├── server.go │ └── config.go ├── cmd │ └── main.go ├── go.mod └── go.sum ├── licenserc.toml ├── MAINTAINERS.adoc ├── README.adoc ├── SECURITY.md ├── scripts └── license-header.txt ├── CONTRIBUTING.adoc ├── CODE_OF_CONDUCT.adoc ├── go.work.sum └── LICENSE.txt /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .DS_Store 3 | .pkl-lsp/ 4 | 5 | *.msgpack -------------------------------------------------------------------------------- /go.work: -------------------------------------------------------------------------------- 1 | go 1.23.7 2 | 3 | toolchain go1.25.0 4 | 5 | use ( 6 | ./buildtimeeval 7 | ./simple 8 | ) 9 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: github-actions 4 | directory: / 5 | ignore: 6 | - dependency-name: '*' 7 | update-types: 8 | - version-update:semver-major 9 | schedule: 10 | interval: weekly 11 | -------------------------------------------------------------------------------- /simple/gen/appconfig/init.pkl.go: -------------------------------------------------------------------------------- 1 | // Code generated from Pkl module `org.pkl.golang.example.AppConfig`. DO NOT EDIT. 2 | package appconfig 3 | 4 | import "github.com/apple/pkl-go/pkl" 5 | 6 | func init() { 7 | pkl.RegisterStrictMapping("org.pkl.golang.example.AppConfig", AppConfig{}) 8 | } 9 | -------------------------------------------------------------------------------- /simple/gen/redisconfig/Auth.pkl.go: -------------------------------------------------------------------------------- 1 | // Code generated from Pkl module `org.pkl.golang.example.RedisConfig`. DO NOT EDIT. 2 | package redisconfig 3 | 4 | type Auth struct { 5 | // Basic HTTP authorization username 6 | Username string `pkl:"username"` 7 | 8 | // Basic HTTP authorization password 9 | Password string `pkl:"password"` 10 | } 11 | -------------------------------------------------------------------------------- /simple/gen/redisconfig/init.pkl.go: -------------------------------------------------------------------------------- 1 | // Code generated from Pkl module `org.pkl.golang.example.RedisConfig`. DO NOT EDIT. 2 | package redisconfig 3 | 4 | import "github.com/apple/pkl-go/pkl" 5 | 6 | func init() { 7 | pkl.RegisterStrictMapping("org.pkl.golang.example.RedisConfig", RedisConfig{}) 8 | pkl.RegisterStrictMapping("org.pkl.golang.example.RedisConfig#Auth", Auth{}) 9 | } 10 | -------------------------------------------------------------------------------- /simple/PklProject.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "resolvedDependencies": { 4 | "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0": { 5 | "type": "remote", 6 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-go/pkl.golang@0.12.0", 7 | "checksums": { 8 | "sha256": "e4bf639653aec5eadaa4322380dcfea8ae553ef2504715845078183151feec3a" 9 | } 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /licenserc.toml: -------------------------------------------------------------------------------- 1 | headerPath = "scripts/license-header.txt" 2 | 3 | includes = [ 4 | "*.go", 5 | "*.pkl", 6 | "*.sh", 7 | "PklProject", 8 | ] 9 | 10 | excludes = [ 11 | "pkl/test_fixtures/", 12 | "codegen/snippet-tests", 13 | "doc", 14 | "*.pkl.go" 15 | ] 16 | 17 | [git] 18 | attrs = 'enable' 19 | ignore = 'enable' 20 | 21 | [mapping.LINE_BLOCK_STYLE] 22 | extensions = ["go"] 23 | -------------------------------------------------------------------------------- /MAINTAINERS.adoc: -------------------------------------------------------------------------------- 1 | = MAINTAINERS 2 | 3 | This page lists all active Maintainers of this repository. 4 | 5 | See link:CONTRIBUTING.adoc[] for general contribution guidelines. 6 | 7 | == Maintainers (in alphabetical order) 8 | 9 | * https://github.com/bioball[Daniel Chao] 10 | * https://github.com/stackoverflow[Islon Scherer] 11 | * https://github.com/HT154[Jen Basch] 12 | * https://github.com/holzensp[Philip Hölzenspies] 13 | -------------------------------------------------------------------------------- /README.adoc: -------------------------------------------------------------------------------- 1 | == pkl-go-examples 2 | 3 | Ready-go-to examples that demonstrate using Pkl with Go applications. 4 | 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.30.0 12 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security 2 | 3 | For the protection of our community, the Pkl team does not disclose, discuss, or confirm security issues until our investigation is complete and any necessary updates are generally available. 4 | 5 | ## Reporting a security vulnerability 6 | 7 | If you have discovered a security vulnerability within the Pkl Go Example project, please report it to us. 8 | We welcome reports from everyone, including security researchers, developers, and users. 9 | 10 | Security vulnerabilities may be reported on the [Report a vulnerability](https://security.apple.com/submit) form. 11 | When submitting a vulnerability, select "Apple Devices and Software" as the affected platform, and "Open Source" as the affected area. 12 | 13 | For more information, see https://pkl-lang.org/security.html. 14 | -------------------------------------------------------------------------------- /scripts/license-header.txt: -------------------------------------------------------------------------------- 1 | Copyright ©{{ " " }}{%- if attrs.git_file_modified_year != attrs.git_file_created_year -%}{{ attrs.git_file_created_year }}-{{ attrs.git_file_modified_year }}{%- else -%}{{ attrs.git_file_created_year }}{%- endif -%}{{ " " }}Apple Inc. and the Pkl project authors. All rights reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | https://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /.github/workflows/__lockfile__.yml: -------------------------------------------------------------------------------- 1 | #file: noinspection MandatoryParamsAbsent,UndefinedAction 2 | # This is a fake workflow that never runs. 3 | # It's used to pin actions to specific git SHAs when generating actual workflows. 4 | # It also gets updated by dependabot (see .github/dependabot.yml). 5 | # Generated from Workflow.pkl. DO NOT EDIT. 6 | name: __lockfile__ 7 | 'on': 8 | push: 9 | branches-ignore: 10 | - '**' 11 | tags-ignore: 12 | - '**' 13 | jobs: 14 | locks: 15 | if: 'false' 16 | runs-on: nothing 17 | steps: 18 | - name: actions/checkout@v6 19 | uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 20 | - name: actions/setup-go@v6 21 | uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6 22 | - name: actions/upload-artifact@v5 23 | uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 24 | -------------------------------------------------------------------------------- /simple/generate.go: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | 17 | //go:generate go tool pkl-gen-go pkl/AppConfig.pkl 18 | package simple 19 | -------------------------------------------------------------------------------- /simple/README.adoc: -------------------------------------------------------------------------------- 1 | = Simple 2 | 3 | This is a simple web service that uses Pkl to drive configuration. 4 | 5 | == Project structure 6 | 7 | [cols=",",options="header",] 8 | |=== 9 | |Directory |Description 10 | |`pkl/` |Pkl configuration sources 11 | |`gen/` |Generated Go sources from Pkl 12 | |`internal/` |Internal Go files 13 | |`cmd/` |Server entrypoint 14 | |=== 15 | 16 | == Codegen 17 | 18 | To generate new Pkl sources for the AppConfig module, run: 19 | 20 | [source,bash] 21 | ---- 22 | go tool pkl-gen-go pkl/AppConfig.pkl 23 | ---- 24 | 25 | Or, alternatively, with `go generate` (see link:./generate.go[generate.go]): 26 | 27 | [source,bash] 28 | ---- 29 | go generate ./... 30 | ---- 31 | 32 | The code generator detects that the Go package for `AppConfig` is 33 | `github.com/apple/pkl-go-examples/simple/gen/appconfig`, and the Go module 34 | name is `github.com/apple/pkl-go-examples` (via the go.mod file), and 35 | therefore places generated sources in `gen/appconfig`. 36 | -------------------------------------------------------------------------------- /simple/PklProject: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | 17 | amends "pkl:Project" 18 | 19 | dependencies { 20 | ["go"] { uri = "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.12.0" } 21 | } 22 | -------------------------------------------------------------------------------- /simple/pkl/dev/config.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | 17 | amends ".../AppConfig.pkl" 18 | 19 | redis { 20 | enabled = true 21 | host = "localhost" 22 | port = 5678 23 | auth { 24 | username = "redis" 25 | password = "redis" 26 | } 27 | } 28 | 29 | logLevel = "info" 30 | -------------------------------------------------------------------------------- /simple/gen/appconfig/loglevel/LogLevel.pkl.go: -------------------------------------------------------------------------------- 1 | // Code generated from Pkl module `org.pkl.golang.example.AppConfig`. DO NOT EDIT. 2 | package loglevel 3 | 4 | import ( 5 | "encoding" 6 | "fmt" 7 | ) 8 | 9 | // The level of logging for the application. 10 | // 11 | // - "error": Log only error level messages 12 | // - "warn": Log error and warning messages 13 | // - "info": Log all messages 14 | type LogLevel string 15 | 16 | const ( 17 | Error LogLevel = "error" 18 | Warn LogLevel = "warn" 19 | Info LogLevel = "info" 20 | ) 21 | 22 | // String returns the string representation of LogLevel 23 | func (rcv LogLevel) String() string { 24 | return string(rcv) 25 | } 26 | 27 | var _ encoding.BinaryUnmarshaler = new(LogLevel) 28 | 29 | // UnmarshalBinary implements encoding.BinaryUnmarshaler for LogLevel. 30 | func (rcv *LogLevel) UnmarshalBinary(data []byte) error { 31 | switch str := string(data); str { 32 | case "error": 33 | *rcv = Error 34 | case "warn": 35 | *rcv = Warn 36 | case "info": 37 | *rcv = Info 38 | default: 39 | return fmt.Errorf(`illegal: "%s" is not a valid LogLevel`, str) 40 | } 41 | return nil 42 | } 43 | -------------------------------------------------------------------------------- /.github/PklProject: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | 17 | amends "pkl:Project" 18 | 19 | dependencies { 20 | ["pkl.impl.ghactions"] { 21 | uri = "package://pkg.pkl-lang.org/pkl-project-commons/pkl.impl.ghactions@1.1.6" 22 | } 23 | ["com.github.actions"] { 24 | uri = "package://pkg.pkl-lang.org/pkl-pantry/com.github.actions@1.3.0" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /simple/internal/config_test.go: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | 17 | package internal_test 18 | 19 | import ( 20 | "testing" 21 | 22 | "github.com/apple/pkl-go-examples/simple/gen/redisconfig" 23 | "github.com/apple/pkl-go-examples/simple/internal" 24 | "github.com/stretchr/testify/assert" 25 | ) 26 | 27 | func TestLoadAppConfig(t *testing.T) { 28 | cfg := internal.LoadAppConfig() 29 | assert.Equal(t, cfg.Port, uint16(5051)) 30 | assert.Equal(t, 31 | cfg.Redis.Auth, 32 | &redisconfig.Auth{ 33 | Username: "redis", 34 | Password: "redis", 35 | }, 36 | ) 37 | } 38 | -------------------------------------------------------------------------------- /simple/gen/redisconfig/RedisConfig.pkl.go: -------------------------------------------------------------------------------- 1 | // Code generated from Pkl module `org.pkl.golang.example.RedisConfig`. DO NOT EDIT. 2 | package redisconfig 3 | 4 | import ( 5 | "context" 6 | 7 | "github.com/apple/pkl-go/pkl" 8 | ) 9 | 10 | type RedisConfig struct { 11 | // Whether Redis connections are enabled or not. 12 | Enabled bool `pkl:"enabled"` 13 | 14 | // The hostname that Redis listens on 15 | Host string `pkl:"host"` 16 | 17 | // The port that Redis listens on 18 | Port uint16 `pkl:"port"` 19 | 20 | // Authorization settings for Redis 21 | Auth *Auth `pkl:"auth"` 22 | } 23 | 24 | // LoadFromPath loads the pkl module at the given path and evaluates it into a RedisConfig 25 | func LoadFromPath(ctx context.Context, path string) (ret RedisConfig, err error) { 26 | evaluator, err := pkl.NewEvaluator(ctx, pkl.PreconfiguredOptions) 27 | if err != nil { 28 | return ret, err 29 | } 30 | defer func() { 31 | cerr := evaluator.Close() 32 | if err == nil { 33 | err = cerr 34 | } 35 | }() 36 | ret, err = Load(ctx, evaluator, pkl.FileSource(path)) 37 | return ret, err 38 | } 39 | 40 | // Load loads the pkl module at the given source and evaluates it with the given evaluator into a RedisConfig 41 | func Load(ctx context.Context, evaluator pkl.Evaluator, source *pkl.ModuleSource) (RedisConfig, error) { 42 | var ret RedisConfig 43 | err := evaluator.EvaluateModule(ctx, source, &ret) 44 | return ret, err 45 | } 46 | -------------------------------------------------------------------------------- /.github/PklProject.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "resolvedDependencies": { 4 | "package://pkg.pkl-lang.org/pkl-pantry/com.github.actions@1": { 5 | "type": "remote", 6 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/com.github.actions@1.3.0", 7 | "checksums": { 8 | "sha256": "76174cb974310b3d952280b76ed224eb4ee6fd5419bf696ad9a66fba44bd427d" 9 | } 10 | }, 11 | "package://pkg.pkl-lang.org/pkl-project-commons/pkl.impl.ghactions@1": { 12 | "type": "remote", 13 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-project-commons/pkl.impl.ghactions@1.1.6", 14 | "checksums": { 15 | "sha256": "efe36e694f45b0804c5fcc746774727c016c866478b8c1eb0ea86d00c8bd8cf2" 16 | } 17 | }, 18 | "package://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.deepToTyped@1": { 19 | "type": "remote", 20 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.deepToTyped@1.1.1", 21 | "checksums": { 22 | "sha256": "1e6e29b441ffdee2605d317f6543a4a604aab5af472b63f0c47d92a3b4b36f7f" 23 | } 24 | }, 25 | "package://pkg.pkl-lang.org/pkl-pantry/com.github.dependabot@1": { 26 | "type": "remote", 27 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/com.github.dependabot@1.0.0", 28 | "checksums": { 29 | "sha256": "02ef6f25bfca5b1d095db73ea15de79d2d2c6832ebcab61e6aba90554382abcb" 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /simple/pkl/RedisConfig.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | 17 | @go.Package { name = "github.com/apple/pkl-go-examples/simple/gen/redisconfig" } 18 | module org.pkl.golang.example.RedisConfig 19 | 20 | import "@go/go.pkl" 21 | 22 | class Auth { 23 | /// Basic HTTP authorization username 24 | username: String 25 | 26 | /// Basic HTTP authorization password 27 | password: String 28 | } 29 | 30 | /// Whether Redis connections are enabled or not. 31 | enabled: Boolean 32 | 33 | /// The hostname that Redis listens on 34 | host: String 35 | 36 | /// The port that Redis listens on 37 | port: UInt16 38 | 39 | /// Authorization settings for Redis 40 | auth: Auth? 41 | -------------------------------------------------------------------------------- /simple/gen/appconfig/AppConfig.pkl.go: -------------------------------------------------------------------------------- 1 | // Code generated from Pkl module `org.pkl.golang.example.AppConfig`. DO NOT EDIT. 2 | package appconfig 3 | 4 | import ( 5 | "context" 6 | 7 | "github.com/apple/pkl-go-examples/simple/gen/appconfig/loglevel" 8 | "github.com/apple/pkl-go-examples/simple/gen/redisconfig" 9 | "github.com/apple/pkl-go/pkl" 10 | ) 11 | 12 | // Application configuration for the Pkl Go Example application. 13 | // 14 | // See generated sources in the gen/ directory. 15 | type AppConfig struct { 16 | // The host to listen on 17 | Host string `pkl:"host"` 18 | 19 | // The application port to listen on 20 | Port uint16 `pkl:"port"` 21 | 22 | // Redis settings for this application 23 | Redis redisconfig.RedisConfig `pkl:"redis"` 24 | 25 | LogLevel loglevel.LogLevel `pkl:"logLevel"` 26 | } 27 | 28 | // LoadFromPath loads the pkl module at the given path and evaluates it into a AppConfig 29 | func LoadFromPath(ctx context.Context, path string) (ret AppConfig, err error) { 30 | evaluator, err := pkl.NewEvaluator(ctx, pkl.PreconfiguredOptions) 31 | if err != nil { 32 | return ret, err 33 | } 34 | defer func() { 35 | cerr := evaluator.Close() 36 | if err == nil { 37 | err = cerr 38 | } 39 | }() 40 | ret, err = Load(ctx, evaluator, pkl.FileSource(path)) 41 | return ret, err 42 | } 43 | 44 | // Load loads the pkl module at the given source and evaluates it with the given evaluator into a AppConfig 45 | func Load(ctx context.Context, evaluator pkl.Evaluator, source *pkl.ModuleSource) (AppConfig, error) { 46 | var ret AppConfig 47 | err := evaluator.EvaluateModule(ctx, source, &ret) 48 | return ret, err 49 | } 50 | -------------------------------------------------------------------------------- /simple/internal/routes.go: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | 17 | package internal 18 | 19 | import ( 20 | "context" 21 | "log/slog" 22 | 23 | "github.com/gin-gonic/gin" 24 | ) 25 | 26 | func routes(s *server) { 27 | s.gin.GET("/", s.okay()) 28 | s.gin.GET("/ping", s.ping()) 29 | } 30 | 31 | func (s *server) okay() gin.HandlerFunc { 32 | return func(c *gin.Context) { 33 | c.JSON(200, gin.H{ 34 | "status": "OK", 35 | "config": s.config, 36 | }) 37 | } 38 | } 39 | 40 | func (s *server) ping() gin.HandlerFunc { 41 | return func(c *gin.Context) { 42 | _, err := s.redis.Ping(context.Background()).Result() 43 | if err != nil { 44 | slog.Error("redis ping failed", "error", err) 45 | c.JSON(500, gin.H{ 46 | "error": err.Error(), 47 | }) 48 | return 49 | } 50 | c.JSON(200, gin.H{ 51 | "status": "OK", 52 | }) 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /simple/cmd/main.go: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | 17 | package main 18 | 19 | import ( 20 | "log/slog" 21 | "os" 22 | 23 | "github.com/apple/pkl-go-examples/simple/gen/appconfig/loglevel" 24 | "github.com/apple/pkl-go-examples/simple/internal" 25 | ) 26 | 27 | func main() { 28 | cfg := internal.LoadAppConfig() 29 | var programLevel = new(slog.LevelVar) 30 | switch cfg.LogLevel { 31 | case loglevel.Info: 32 | programLevel.Set(slog.LevelInfo) 33 | case loglevel.Warn: 34 | programLevel.Set(slog.LevelWarn) 35 | case loglevel.Error: 36 | programLevel.Set(slog.LevelError) 37 | } 38 | 39 | logger := slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{Level: programLevel})) 40 | slog.SetDefault(logger) 41 | 42 | slog.Info("Starting server", "port", cfg.Port) 43 | 44 | if err := internal.NewServer(cfg).Run(); err != nil { 45 | panic(err) 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /simple/pkl/AppConfig.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | 17 | /// Application configuration for the Pkl Go Example application. 18 | /// 19 | /// See generated sources in the gen/ directory. 20 | @go.Package { name = "github.com/apple/pkl-go-examples/simple/gen/appconfig" } 21 | module org.pkl.golang.example.AppConfig 22 | 23 | import "@go/go.pkl" 24 | 25 | import "RedisConfig.pkl" 26 | 27 | typealias Port = UInt16(this > 0) 28 | 29 | /// The host to listen on 30 | host: String = "127.0.0.1" 31 | 32 | /// The application port to listen on 33 | port: Port = 5051 34 | 35 | /// Redis settings for this application 36 | redis: RedisConfig 37 | 38 | /// The level of logging for the application. 39 | /// 40 | /// - "error": Log only error level messages 41 | /// - "warn": Log error and warning messages 42 | /// - "info": Log all messages 43 | typealias LogLevel = "error" | "warn" | "info" 44 | 45 | logLevel: LogLevel 46 | -------------------------------------------------------------------------------- /CONTRIBUTING.adoc: -------------------------------------------------------------------------------- 1 | :uri-github-issue-pkl: https://github.com/apple/pkl-go-example/issues/new 2 | :uri-seven-rules: https://cbea.ms/git-commit/#seven-rules 3 | 4 | = Pkl Go Examples Contributors Guide 5 | 6 | Welcome to the Pkl community, and thank you for contributing! 7 | This guide explains how to get involved. 8 | 9 | * <> 10 | * <> 11 | * <> 12 | 13 | == Licensing 14 | 15 | Pkl Go Examples is released under the Apache 2.0 license. 16 | This is why we require that, by submitting a pull request, you acknowledge that you have the right to license your contribution to Apple and the community, and agree that your contribution is licensed under the Apache 2.0 license. 17 | 18 | == Issue Tracking 19 | 20 | To file a bug or feature request, use {uri-github-issue-pkl}[GitHub]. 21 | Be sure to include the following information: 22 | 23 | * Context 24 | ** What are/were you trying to achieve? 25 | ** What's the impact of this bug/feature? 26 | 27 | == Pull Requests 28 | 29 | When preparing a pull request, follow this checklist: 30 | 31 | * Imitate the conventions of surrounding code. 32 | * Format `.pkl` files in your PR with the JetBrains IDE formatter. 33 | * Follow the {uri-seven-rules}[seven rules] of great Git commit messages: 34 | ** Separate subject from body with a blank line. 35 | ** Limit the subject line to 50 characters. 36 | ** Capitalize the subject line. 37 | ** Do not end the subject line with a period. 38 | ** Use the imperative mood in the subject line. 39 | ** Wrap the body at 72 characters. 40 | ** Use the body to explain what and why vs. how. 41 | 42 | == Maintainers 43 | 44 | The project’s maintainers (those with write access to the upstream repository) are listed in link:MAINTAINERS.adoc[]. 45 | -------------------------------------------------------------------------------- /simple/internal/server.go: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | 17 | package internal 18 | 19 | import ( 20 | "fmt" 21 | 22 | "github.com/go-redis/redis/v8" 23 | 24 | "github.com/apple/pkl-go-examples/simple/gen/appconfig" 25 | "github.com/gin-gonic/gin" 26 | ) 27 | 28 | type server struct { 29 | gin *gin.Engine 30 | config appconfig.AppConfig 31 | redis *redis.Client 32 | } 33 | 34 | type Server interface { 35 | Run() error 36 | } 37 | 38 | var _ Server = (*server)(nil) 39 | 40 | func (s server) Run() error { 41 | return s.gin.Run(fmt.Sprintf("%s:%d", s.config.Host, s.config.Port)) 42 | } 43 | 44 | func NewServer(config appconfig.AppConfig) Server { 45 | s := &server{ 46 | gin: gin.Default(), 47 | config: config, 48 | redis: redis.NewClient(&redis.Options{ 49 | Addr: fmt.Sprintf("%s:%d", config.Redis.Host, config.Redis.Port), 50 | Password: config.Redis.Auth.Password, 51 | Username: config.Redis.Auth.Username, 52 | }), 53 | } 54 | routes(s) 55 | return s 56 | } 57 | -------------------------------------------------------------------------------- /simple/internal/config.go: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | 17 | package internal 18 | 19 | import ( 20 | "context" 21 | "net/url" 22 | "path/filepath" 23 | "runtime" 24 | 25 | "github.com/apple/pkl-go-examples/simple/gen/appconfig" 26 | "github.com/apple/pkl-go/pkl" 27 | ) 28 | 29 | // LoadAppConfig loads an app config given the configured evaluator, with the set project dir. 30 | // Alternatively, there's also the shorthand `appconfig.LoadFromPath` which uses only the preconfigured evaluator. 31 | func LoadAppConfig() appconfig.AppConfig { 32 | _, filename, _, ok := runtime.Caller(0) 33 | if !ok { 34 | panic("Error: could not get caller information.") 35 | } 36 | path := filepath.Join(filepath.Dir(filename), "..") 37 | u := &url.URL{Path: path, Scheme: "file"} 38 | evaluator, err := pkl.NewProjectEvaluator(context.Background(), u, pkl.PreconfiguredOptions) 39 | if err != nil { 40 | panic(err) 41 | } 42 | defer evaluator.Close() 43 | cfg, err := appconfig.Load(context.Background(), evaluator, pkl.FileSource(filename, "../../pkl/dev/config.pkl")) 44 | if err != nil { 45 | panic(err) 46 | } 47 | return cfg 48 | } 49 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | # Generated from Workflow.pkl. DO NOT EDIT. 2 | name: Build (main) 3 | 'on': 4 | push: 5 | branches: 6 | - main 7 | tags-ignore: 8 | - '**' 9 | concurrency: 10 | group: ${{ github.workflow }}-${{ github.ref }} 11 | cancel-in-progress: false 12 | permissions: 13 | contents: read 14 | jobs: 15 | test: 16 | runs-on: ubuntu-latest 17 | steps: 18 | - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 19 | with: 20 | persist-credentials: false 21 | - uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6 22 | with: 23 | go-version: '1.25' 24 | check-latest: true 25 | cache-dependency-path: go.work.sum 26 | - name: Setup Pkl 27 | id: setup-pkl 28 | env: 29 | PKL_VERSION: 0.30.0 30 | PKL_FILENAME: pkl 31 | PKL_DOWNLOAD_URL: https://github.com/apple/pkl/releases/download/0.30.0/pkl-linux-amd64 32 | shell: bash 33 | run: |- 34 | DIR="$(mktemp -d /tmp/pkl-$PKL_VERSION-XXXXXX)" 35 | PKL_EXEC="$DIR/$PKL_FILENAME" 36 | curl -sfL -o $PKL_EXEC "$PKL_DOWNLOAD_URL" 37 | chmod +x $PKL_EXEC 38 | echo "$DIR" >> "$GITHUB_PATH" 39 | echo "pkl_exec=$PKL_EXEC" >> "$GITHUB_OUTPUT" 40 | - name: go generate 41 | run: go list -f '{{.Dir}}/...' -m | xargs go generate 42 | - name: go test 43 | run: go list -f '{{.Dir}}/...' -m | xargs go test 44 | - name: pkl format 45 | run: pkl format --diff-name-only . 46 | hawkeye-check: 47 | name: hawkeye-check 48 | runs-on: ubuntu-latest 49 | steps: 50 | - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 51 | with: 52 | persist-credentials: false 53 | fetch-depth: 0 54 | - run: hawkeye check --config licenserc.toml --fail-if-unknown 55 | container: 56 | image: ghcr.io/korandoru/hawkeye@sha256:c3ab994c0d81f3d116aabf9afc534e18648e3e90d7525d741c1e99dd8166ec85 57 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | # Generated from Workflow.pkl. DO NOT EDIT. 2 | name: Build 3 | 'on': 4 | push: 5 | branches-ignore: 6 | - main 7 | - release/* 8 | tags-ignore: 9 | - '**' 10 | concurrency: 11 | group: ${{ github.workflow }}-${{ github.ref }} 12 | cancel-in-progress: false 13 | permissions: 14 | contents: read 15 | jobs: 16 | test: 17 | runs-on: ubuntu-latest 18 | steps: 19 | - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 20 | with: 21 | persist-credentials: false 22 | - uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6 23 | with: 24 | go-version: '1.25' 25 | check-latest: true 26 | cache-dependency-path: go.work.sum 27 | - name: Setup Pkl 28 | id: setup-pkl 29 | env: 30 | PKL_VERSION: 0.30.0 31 | PKL_FILENAME: pkl 32 | PKL_DOWNLOAD_URL: https://github.com/apple/pkl/releases/download/0.30.0/pkl-linux-amd64 33 | shell: bash 34 | run: |- 35 | DIR="$(mktemp -d /tmp/pkl-$PKL_VERSION-XXXXXX)" 36 | PKL_EXEC="$DIR/$PKL_FILENAME" 37 | curl -sfL -o $PKL_EXEC "$PKL_DOWNLOAD_URL" 38 | chmod +x $PKL_EXEC 39 | echo "$DIR" >> "$GITHUB_PATH" 40 | echo "pkl_exec=$PKL_EXEC" >> "$GITHUB_OUTPUT" 41 | - name: go generate 42 | run: go list -f '{{.Dir}}/...' -m | xargs go generate 43 | - name: go test 44 | run: go list -f '{{.Dir}}/...' -m | xargs go test 45 | - name: pkl format 46 | run: pkl format --diff-name-only . 47 | hawkeye-check: 48 | name: hawkeye-check 49 | runs-on: ubuntu-latest 50 | steps: 51 | - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 52 | with: 53 | persist-credentials: false 54 | fetch-depth: 0 55 | - run: hawkeye check --config licenserc.toml --fail-if-unknown 56 | container: 57 | image: ghcr.io/korandoru/hawkeye@sha256:c3ab994c0d81f3d116aabf9afc534e18648e3e90d7525d741c1e99dd8166ec85 58 | -------------------------------------------------------------------------------- /.github/index.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | 17 | amends "@pkl.impl.ghactions/PklCI.pkl" 18 | 19 | import "@com.github.actions/catalog.pkl" 20 | import "@com.github.actions/Workflow.pkl" 21 | import "@pkl.impl.ghactions/jobs/HawkeyeCheck.pkl" 22 | import "@pkl.impl.ghactions/steps/SetupPkl.pkl" 23 | 24 | local test: Workflow = new { 25 | jobs { 26 | ["test"] { 27 | `runs-on` = "ubuntu-latest" 28 | steps { 29 | catalog.`actions/checkout@v6` 30 | (catalog.`actions/setup-go@v6`) { 31 | with { 32 | `go-version` = "1.25" 33 | `check-latest` = true 34 | `cache-dependency-path` = "go.work.sum" 35 | } 36 | } 37 | new SetupPkl { version = "0.30.0" }.step 38 | new { 39 | name = "go generate" 40 | run = 41 | """ 42 | go list -f '{{.Dir}}/...' -m | xargs go generate 43 | """ 44 | } 45 | new { 46 | name = "go test" 47 | run = 48 | """ 49 | go list -f '{{.Dir}}/...' -m | xargs go test 50 | """ 51 | } 52 | new { 53 | name = "pkl format" 54 | run = 55 | """ 56 | pkl format --diff-name-only . 57 | """ 58 | } 59 | } 60 | } 61 | ["hawkeye-check"] = new HawkeyeCheck {}.job 62 | } 63 | } 64 | 65 | prb = test 66 | 67 | build = test 68 | 69 | main = test 70 | -------------------------------------------------------------------------------- /simple/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/apple/pkl-go-examples/simple 2 | 3 | go 1.23.7 4 | 5 | toolchain go1.25.0 6 | 7 | require ( 8 | github.com/apple/pkl-go v0.12.0 9 | github.com/gin-gonic/gin v1.11.0 10 | github.com/go-redis/redis/v8 v8.11.5 11 | github.com/stretchr/testify v1.11.1 12 | ) 13 | 14 | require ( 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 19 | github.com/davecgh/go-spew v1.1.1 // indirect 20 | github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect 21 | github.com/gabriel-vasile/mimetype v1.4.10 // indirect 22 | github.com/gin-contrib/sse v1.1.0 // indirect 23 | github.com/go-playground/locales v0.14.1 // indirect 24 | github.com/go-playground/universal-translator v0.18.1 // 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/goccy/go-yaml v1.18.0 // indirect 28 | github.com/google/go-cmp v0.7.0 // indirect 29 | github.com/inconshreveable/mousetrap v1.1.0 // indirect 30 | github.com/json-iterator/go v1.1.12 // indirect 31 | github.com/klauspost/cpuid/v2 v2.3.0 // indirect 32 | github.com/leodido/go-urn v1.4.0 // indirect 33 | github.com/mattn/go-isatty v0.0.20 // indirect 34 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect 35 | github.com/modern-go/reflect2 v1.0.2 // indirect 36 | github.com/pelletier/go-toml/v2 v2.2.4 // indirect 37 | github.com/pmezard/go-difflib v1.0.0 // indirect 38 | github.com/quic-go/qpack v0.5.1 // indirect 39 | github.com/quic-go/quic-go v0.54.0 // indirect 40 | github.com/spf13/cobra v1.8.0 // indirect 41 | github.com/spf13/pflag v1.0.5 // indirect 42 | github.com/twitchyliquid64/golang-asm v0.15.1 // indirect 43 | github.com/ugorji/go/codec v1.3.0 // indirect 44 | github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect 45 | github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect 46 | go.uber.org/mock v0.5.0 // indirect 47 | golang.org/x/arch v0.20.0 // indirect 48 | golang.org/x/crypto v0.41.0 // indirect 49 | golang.org/x/mod v0.26.0 // indirect 50 | golang.org/x/net v0.43.0 // indirect 51 | golang.org/x/sync v0.16.0 // indirect 52 | golang.org/x/sys v0.35.0 // indirect 53 | golang.org/x/text v0.28.0 // indirect 54 | golang.org/x/tools v0.35.0 // indirect 55 | google.golang.org/protobuf v1.36.9 // indirect 56 | gopkg.in/yaml.v3 v3.0.1 // indirect 57 | ) 58 | 59 | tool github.com/apple/pkl-go/cmd/pkl-gen-go 60 | -------------------------------------------------------------------------------- /.github/workflows/prb.yml: -------------------------------------------------------------------------------- 1 | # Generated from Workflow.pkl. DO NOT EDIT. 2 | name: Pull Request 3 | 'on': 4 | pull_request: {} 5 | concurrency: 6 | group: ${{ github.workflow }}-${{ github.ref }} 7 | cancel-in-progress: true 8 | permissions: 9 | contents: read 10 | jobs: 11 | test: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 15 | with: 16 | persist-credentials: false 17 | - uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6 18 | with: 19 | go-version: '1.25' 20 | check-latest: true 21 | cache-dependency-path: go.work.sum 22 | - name: Setup Pkl 23 | id: setup-pkl 24 | env: 25 | PKL_VERSION: 0.30.0 26 | PKL_FILENAME: pkl 27 | PKL_DOWNLOAD_URL: https://github.com/apple/pkl/releases/download/0.30.0/pkl-linux-amd64 28 | shell: bash 29 | run: |- 30 | DIR="$(mktemp -d /tmp/pkl-$PKL_VERSION-XXXXXX)" 31 | PKL_EXEC="$DIR/$PKL_FILENAME" 32 | curl -sfL -o $PKL_EXEC "$PKL_DOWNLOAD_URL" 33 | chmod +x $PKL_EXEC 34 | echo "$DIR" >> "$GITHUB_PATH" 35 | echo "pkl_exec=$PKL_EXEC" >> "$GITHUB_OUTPUT" 36 | - name: go generate 37 | run: go list -f '{{.Dir}}/...' -m | xargs go generate 38 | - name: go test 39 | run: go list -f '{{.Dir}}/...' -m | xargs go test 40 | - name: pkl format 41 | run: pkl format --diff-name-only . 42 | hawkeye-check: 43 | name: hawkeye-check 44 | runs-on: ubuntu-latest 45 | steps: 46 | - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 47 | with: 48 | persist-credentials: false 49 | fetch-depth: 0 50 | - run: hawkeye check --config licenserc.toml --fail-if-unknown 51 | container: 52 | image: ghcr.io/korandoru/hawkeye@sha256:c3ab994c0d81f3d116aabf9afc534e18648e3e90d7525d741c1e99dd8166ec85 53 | upload-event-file: 54 | runs-on: ubuntu-latest 55 | steps: 56 | - name: Upload event file 57 | if: '!cancelled()' 58 | uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 59 | with: 60 | name: test-results-event-file 61 | path: ${{ github.event_path }} 62 | check-pkl-github-actions: 63 | runs-on: ubuntu-latest 64 | steps: 65 | - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 66 | with: 67 | persist-credentials: false 68 | - name: Setup Pkl 69 | id: setup-pkl 70 | env: 71 | PKL_VERSION: 0.30.0 72 | PKL_FILENAME: pkl 73 | PKL_DOWNLOAD_URL: https://github.com/apple/pkl/releases/download/0.30.0/pkl-linux-amd64 74 | shell: bash 75 | run: |- 76 | DIR="$(mktemp -d /tmp/pkl-$PKL_VERSION-XXXXXX)" 77 | PKL_EXEC="$DIR/$PKL_FILENAME" 78 | curl -sfL -o $PKL_EXEC "$PKL_DOWNLOAD_URL" 79 | chmod +x $PKL_EXEC 80 | echo "$DIR" >> "$GITHUB_PATH" 81 | echo "pkl_exec=$PKL_EXEC" >> "$GITHUB_OUTPUT" 82 | - shell: bash 83 | run: pkl eval -m .github/ --project-dir .github/ .github/index.pkl 84 | - name: check git status 85 | shell: bash 86 | run: |- 87 | if [ -n "$(git status --porcelain)" ]; then 88 | echo "Running pkl resulted in a diff! You likely need to run 'pkl eval' and commit the changes." 89 | git diff --name-only 90 | exit 1 91 | fi 92 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.adoc: -------------------------------------------------------------------------------- 1 | == Code of Conduct 2 | 3 | === Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our 7 | project and our community a harassment-free experience for everyone, 8 | regardless of age, body size, disability, ethnicity, sex 9 | characteristics, gender identity and expression, level of experience, 10 | education, socio-economic status, nationality, personal appearance, 11 | race, religion, or sexual identity and orientation. 12 | 13 | === Our Standards 14 | 15 | Examples of behavior that contributes to creating a positive environment 16 | include: 17 | 18 | * Using welcoming and inclusive language 19 | * Being respectful of differing viewpoints and experiences 20 | * Gracefully accepting constructive criticism 21 | * Focusing on what is best for the community 22 | * Showing empathy towards other community members 23 | 24 | Examples of unacceptable behavior by participants include: 25 | 26 | * The use of sexualized language or imagery and unwelcome sexual 27 | attention or advances 28 | * Trolling, insulting/derogatory comments, and personal or political 29 | attacks 30 | * Public or private harassment 31 | * Publishing others’ private information, such as a physical or 32 | electronic address, without explicit permission 33 | * Other conduct which could reasonably be considered inappropriate in a 34 | professional setting 35 | 36 | === Our Responsibilities 37 | 38 | Project maintainers are responsible for clarifying the standards of 39 | acceptable behavior and are expected to take appropriate and fair 40 | corrective action in response to any instances of unacceptable behavior. 41 | 42 | Project maintainers have the right and responsibility to remove, edit, 43 | or reject comments, commits, code, wiki edits, issues, and other 44 | contributions that are not aligned to this Code of Conduct, or to ban 45 | temporarily or permanently any contributor for other behaviors that they 46 | deem inappropriate, threatening, offensive, or harmful. 47 | 48 | === Scope 49 | 50 | This Code of Conduct applies within all project spaces, and it also 51 | applies when an individual is representing the project or its community 52 | in public spaces. Examples of representing a project or community 53 | include using an official project e-mail address, posting via an 54 | official social media account, or acting as an appointed representative 55 | at an online or offline event. Representation of a project may be 56 | further defined and clarified by project maintainers. 57 | 58 | === Enforcement 59 | 60 | Instances of abusive, harassing, or otherwise unacceptable behavior may 61 | be reported by contacting the open source team at 62 | opensource-conduct@group.apple.com. All complaints will be reviewed and 63 | investigated and will result in a response that is deemed necessary and 64 | appropriate to the circumstances. The project team is obligated to 65 | maintain confidentiality with regard to the reporter of an incident. 66 | Further details of specific enforcement policies may be posted 67 | separately. 68 | 69 | Project maintainers who do not follow or enforce the Code of Conduct in 70 | good faith may face temporary or permanent repercussions as determined 71 | by other members of the project’s leadership. 72 | 73 | === Attribution 74 | 75 | This Code of Conduct is adapted from the 76 | https://www.contributor-covenant.org[Contributor Covenant], version 1.4, 77 | available at 78 | https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 79 | -------------------------------------------------------------------------------- /go.work.sum: -------------------------------------------------------------------------------- 1 | github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= 2 | github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= 3 | github.com/cloudwego/base64x v0.1.5/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= 4 | github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg= 5 | github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= 6 | github.com/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM= 7 | github.com/francoispqt/gojay v1.2.13 h1:d2m3sFjloqoIUQU3TsHBgj6qg/BVGlTBeHDUmyJnXKk= 8 | github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY= 9 | github.com/gabriel-vasile/mimetype v1.4.8/go.mod h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8= 10 | github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= 11 | github.com/golang/protobuf v1.5.0 h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4= 12 | github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= 13 | github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 14 | github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= 15 | github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= 16 | github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= 17 | github.com/klauspost/cpuid/v2 v2.2.9/go.mod h1:rqkxqrZ1EhYM9G+hXH7YdowN5R5RGN6NK4QwQ3WMXF8= 18 | github.com/knz/go-libedit v1.10.1 h1:0pHpWtx9vcvC0xGZqEQlQdfSQs7WRlAjuPvk3fOZDCo= 19 | github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= 20 | github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= 21 | github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= 22 | github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= 23 | github.com/prometheus/common v0.48.0 h1:QO8U2CdOzSn1BBsmXJXduaaW+dY/5QLjfB8svtSzKKE= 24 | github.com/prometheus/common v0.48.0/go.mod h1:0/KsvlIEfPQCQ5I2iNSAWKPZziNCvRs5EC6ILDTlAPc= 25 | github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= 26 | github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= 27 | github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= 28 | github.com/spf13/cobra v1.3.0/go.mod h1:BrRVncBjOJa/eUcVVm9CE+oC6as8k+VYr4NY7WCi9V4= 29 | github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= 30 | github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= 31 | github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= 32 | github.com/yuin/goldmark v1.4.13 h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE= 33 | github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= 34 | golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= 35 | golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M= 36 | golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY= 37 | golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= 38 | golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= 39 | golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= 40 | golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= 41 | golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= 42 | golang.org/x/mod v0.25.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= 43 | golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= 44 | golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= 45 | golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= 46 | golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= 47 | golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= 48 | golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 49 | golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 50 | golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 51 | golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 52 | golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= 53 | golang.org/x/telemetry v0.0.0-20250710130107-8d8967aff50b h1:DU+gwOBXU+6bO0sEyO7o/NeMlxZxCZEvI7v+J4a1zRQ= 54 | golang.org/x/telemetry v0.0.0-20250710130107-8d8967aff50b/go.mod h1:4ZwOYna0/zsOKwuR5X/m0QFOJpSZvAxFfkQT+Erd9D4= 55 | golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= 56 | golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw= 57 | golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= 58 | golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4= 59 | golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw= 60 | golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY= 61 | golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= 62 | golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= 63 | golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= 64 | golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= 65 | golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= 66 | golang.org/x/tools v0.34.0/go.mod h1:pAP9OwEaY1CAW3HOmg3hLZC5Z0CCmzjAF2UQMSqNARg= 67 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= 68 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 69 | google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= 70 | nullprogram.com/x/optparse v1.0.0 h1:xGFgVi5ZaWOnYdac2foDT3vg0ZZC9ErXFV57mr4OHrI= 71 | rsc.io/pdf v0.1.1 h1:k1MczvYDUvJBe93bYd7wrZLLUEcLZAuF824/I4e5Xr4= 72 | rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= 73 | -------------------------------------------------------------------------------- /simple/go.sum: -------------------------------------------------------------------------------- 1 | github.com/apple/pkl-go v0.12.0 h1:0gnhEIXo6coSHPpxdOESfGn2GrSkBSaeitkZLwZAcWE= 2 | github.com/apple/pkl-go v0.12.0/go.mod h1:EDQmYVtFBok/eLI+9rT0EoBBXNtMM1THwR+rwBcAH3I= 3 | github.com/bytedance/sonic v1.14.0 h1:/OfKt8HFw0kh2rj8N0F6C/qPGRESq0BbaNZgcNXXzQQ= 4 | github.com/bytedance/sonic v1.14.0/go.mod h1:WoEbx8WTcFJfzCe0hbmyTGrfjt8PzNEBdxlNUO24NhA= 5 | github.com/bytedance/sonic/loader v0.3.0 h1:dskwH8edlzNMctoruo8FPTJDF3vLtDT0sXZwvZJyqeA= 6 | github.com/bytedance/sonic/loader v0.3.0/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI= 7 | github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= 8 | github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= 9 | github.com/cloudwego/base64x v0.1.6 h1:t11wG9AECkCDk5fMSoxmufanudBtJ+/HemLstXDLI2M= 10 | github.com/cloudwego/base64x v0.1.6/go.mod h1:OFcloc187FXDaYHvrNIjxSe8ncn0OOM8gEHfghB2IPU= 11 | github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= 12 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 13 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 14 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 15 | github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= 16 | github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= 17 | github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= 18 | github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= 19 | github.com/gabriel-vasile/mimetype v1.4.10 h1:zyueNbySn/z8mJZHLt6IPw0KoZsiQNszIpU+bX4+ZK0= 20 | github.com/gabriel-vasile/mimetype v1.4.10/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s= 21 | github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w= 22 | github.com/gin-contrib/sse v1.1.0/go.mod h1:hxRZ5gVpWMT7Z0B0gSNYqqsSCNIJMjzvm6fqCz9vjwM= 23 | github.com/gin-gonic/gin v1.11.0 h1:OW/6PLjyusp2PPXtyxKHU0RbX6I/l28FTdDlae5ueWk= 24 | github.com/gin-gonic/gin v1.11.0/go.mod h1:+iq/FyxlGzII0KHiBGjuNn4UNENUlKbGlNmc+W50Dls= 25 | github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= 26 | github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= 27 | github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= 28 | github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= 29 | github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= 30 | github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= 31 | github.com/go-playground/validator/v10 v10.27.0 h1:w8+XrWVMhGkxOaaowyKH35gFydVHOvC0/uWoy2Fzwn4= 32 | github.com/go-playground/validator/v10 v10.27.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo= 33 | github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI= 34 | github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo= 35 | github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4= 36 | github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= 37 | github.com/goccy/go-yaml v1.18.0 h1:8W7wMFS12Pcas7KU+VVkaiCng+kG8QiFeFwzFb+rwuw= 38 | github.com/goccy/go-yaml v1.18.0/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA= 39 | github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= 40 | github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= 41 | github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= 42 | github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= 43 | github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= 44 | github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= 45 | github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= 46 | github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y= 47 | github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= 48 | github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= 49 | github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= 50 | github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= 51 | github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= 52 | github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= 53 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= 54 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= 55 | github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= 56 | github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= 57 | github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= 58 | github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= 59 | github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= 60 | github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= 61 | github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE= 62 | github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= 63 | github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4= 64 | github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= 65 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 66 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 67 | github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI= 68 | github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg= 69 | github.com/quic-go/quic-go v0.54.0 h1:6s1YB9QotYI6Ospeiguknbp2Znb/jZYjZLRXn9kMQBg= 70 | github.com/quic-go/quic-go v0.54.0/go.mod h1:e68ZEaCdyviluZmy44P6Iey98v/Wfz6HCjQEm+l8zTY= 71 | github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 72 | github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= 73 | github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= 74 | github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= 75 | github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= 76 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 77 | github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= 78 | github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= 79 | github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= 80 | github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 81 | github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= 82 | github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= 83 | github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= 84 | github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= 85 | github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= 86 | github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= 87 | github.com/ugorji/go/codec v1.3.0 h1:Qd2W2sQawAfG8XSvzwhBeoGq71zXOC/Q1E9y/wUcsUA= 88 | github.com/ugorji/go/codec v1.3.0/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4= 89 | github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8= 90 | github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok= 91 | github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= 92 | github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= 93 | go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= 94 | go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= 95 | golang.org/x/arch v0.20.0 h1:dx1zTU0MAE98U+TQ8BLl7XsJbgze2WnNKF/8tGp/Q6c= 96 | golang.org/x/arch v0.20.0/go.mod h1:bdwinDaKcfZUGpH09BB7ZmOfhalA8lQdzl62l8gGWsk= 97 | golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4= 98 | golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc= 99 | golang.org/x/mod v0.26.0 h1:EGMPT//Ezu+ylkCijjPc+f4Aih7sZvaAr+O3EHBxvZg= 100 | golang.org/x/mod v0.26.0/go.mod h1:/j6NAhSk8iQ723BGAUyoAcn7SlD7s15Dp9Nd/SfeaFQ= 101 | golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= 102 | golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= 103 | golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw= 104 | golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= 105 | golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 106 | golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= 107 | golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= 108 | golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= 109 | golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= 110 | golang.org/x/tools v0.35.0 h1:mBffYraMEf7aa0sB+NuKnuCy8qI/9Bughn8dC2Gu5r0= 111 | golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw= 112 | google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw= 113 | google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= 114 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= 115 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 116 | gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= 117 | gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= 118 | gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= 119 | gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= 120 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 121 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 122 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 123 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | --------------------------------------------------------------------------------