Пример
github.com/lyft/protoc-gen-star/v2 v2.0.3: JoinPaths
Проверенный пример — golang github.com/lyft/protoc-gen-star/v2 v2.0.3: JoinPaths. Контракт выполнен на go 1.26 · linux debian/x64 · docker и пройден.
sha256:1303ec27776cd9bc1f762837441a06eff50a2d11d981d1fc52b11e4377fc0e10
Эта сеть предлагает одно: образец, который собирается. Она запустила его в песочнице и сохранила подписанную квитанцию. Она ничего не оценивает и ничего не гарантирует — собирается ли тот же код у вас, она не измеряла.
Сколько различных ключей подписи подали пройденную квитанцию контракта. Один — только автор; больше одного — значит, кто-то ещё тоже собрал. Ключ создаётся сам и не имеет зарегистрированной личности, поэтому считаются ключи, а не люди.
MIT-0
Свидетельства выполнения
Заявленное окружение и подписанные запуски разделены, чтобы вы точно видели, что этот образец запускал и где.
- Основа свидетельства
- Подписанный контракт пройден
- Квитанции проверки
- 1
- Ключи подписи, собравшие его
- 1
Заявленная среда
go 1.26 linux 24 · ubuntu · glibc 2.39 x64 go 1.26 go go 1
Среды запусков проверки
| Окружение | Контракт | Этапы | Запуск |
|---|---|---|---|
| go 1.26 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · golang@1golang:1.26@sha256:e30143be198a… |
2026-10-11 |
Кейс
HOW- Цель
- verify github.com/lyft/protoc-gen-star/v2.JoinPaths in pkg:golang/github.com/lyft/protoc-gen-star/v2@v2.0.3
- Символы
-
- github.com/lyft/protoc-gen-star/v2.JoinPaths
- Окружение
- go 1.26.6
- Создан
- 2026-10-11T15:27:11Z
Контракт
- pgs.JoinPaths joins multiple directory and file segments into a cleaned FilePath
- pgs.JoinPaths normalizes relative paths resolving dot and dot-dot segments
- pgs.JoinPaths handles empty string elements by omitting redundant separators
- pgs.JoinPaths returns an empty FilePath when called with no arguments
- pgs.JoinPaths produces a FilePath type supporting Dir, Base, and Ext operations
Файлы
- PROMPT.md
- csx.json
- go.mod
- go.sum
- main.go
- spec.json
- test/contract.go
Исходный код
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify github.com/lyft/protoc-gen-star/v2.JoinPaths in pkg:golang/github.com/lyft/protoc-gen-star/v2@v2.0.3
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/github.com/lyft/protoc-gen-star/v2@v2.0.3
Demonstrate these symbols/APIs:
- github.com/lyft/protoc-gen-star/v2.JoinPaths
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:a44d613769bbfeb098a60c4fba4e20fef39d70341f6aff6c5f30c566b3af7428","contract":["pgs.JoinPaths joins multiple directory and file segments into a cleaned FilePath","pgs.JoinPaths normalizes relative paths resolving dot and dot-dot segments","pgs.JoinPaths handles empty string elements by omitting redundant separators","pgs.JoinPaths returns an empty FilePath when called with no arguments","pgs.JoinPaths produces a FilePath type supporting Dir, Base, and Ext operations"],"goal":"verify github.com/lyft/protoc-gen-star/v2.JoinPaths in pkg:golang/github.com/lyft/protoc-gen-star/v2@v2.0.3","kind":"HOW","packages":["pkg:golang/github.com/lyft/protoc-gen-star/v2@v2.0.3"],"schemaVersion":1,"symbols":["github.com/lyft/protoc-gen-star/v2.JoinPaths"]},"contractCommand":["go","run","./test"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"golang","language":"go","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"go","packageManagerVersion":"1.26.6","runtime":"go","runtimeVersion":"1.26.6","schemaVersion":1},"license":"MIT-0","packages":["pkg:golang/github.com/lyft/protoc-gen-star/v2@v2.0.3"],"schemaVersion":1,"subject":"pkg:golang/github.com/lyft/protoc-gen-star/v2@v2.0.3","symbols":["github.com/lyft/protoc-gen-star/v2.JoinPaths"],"verifierAdapter":"golang@1"}
module sample
go 1.26.6
require github.com/lyft/protoc-gen-star/v2 v2.0.3
require (
github.com/spf13/afero v1.3.3 // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/protobuf v1.23.0 // indirect
)
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
github.com/lyft/protoc-gen-star/v2 v2.0.3 h1:/3+/2sWyXeMLzKd1bX+ixWKgEMsULrIivpDsuaF441o=
github.com/lyft/protoc-gen-star/v2 v2.0.3/go.mod h1:amey7yeodaJhXSbf/TlLvWiqQfLOSpEk//mLlc+axEk=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/spf13/afero v1.3.3 h1:p5gZEKLYoL7wh8VrJesMaYeNxdEd1v3cb4irOk9zB54=
github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
package main
import (
"fmt"
pgs "github.com/lyft/protoc-gen-star/v2"
)
func main() {
// Join multiple directory segments and file name into a FilePath
protoPath := pgs.JoinPaths("proto", "service", "v1", "service.proto")
fmt.Printf("Joined path: %s\n", protoPath.String())
// FilePath provides helper methods such as Dir, Base, and Ext
fmt.Printf("Directory: %s\n", protoPath.Dir())
fmt.Printf("Base: %s\n", protoPath.Base())
fmt.Printf("Extension: %s\n", protoPath.Ext())
// JoinPaths also cleans path elements with relative references
cleanPath := pgs.JoinPaths("proto", "legacy", "..", "service", "v1")
fmt.Printf("Cleaned relative path: %s\n", cleanPath.String())
}
{
"schemaVersion": 1,
"goal": "verify github.com/lyft/protoc-gen-star/v2.JoinPaths in pkg:golang/github.com/lyft/protoc-gen-star/v2@v2.0.3",
"kind": "HOW",
"packages": [
"pkg:golang/github.com/lyft/protoc-gen-star/v2@v2.0.3"
],
"symbols": [
"github.com/lyft/protoc-gen-star/v2.JoinPaths"
]
}
package main
import (
"fmt"
"os"
pgs "github.com/lyft/protoc-gen-star/v2"
)
func main() {
// Assertion 1: pgs.JoinPaths joins multiple directory and file segments into a cleaned FilePath
{
res := pgs.JoinPaths("proto", "models", "user.proto")
expected := pgs.FilePath("proto/models/user.proto")
if res != expected || res.String() != "proto/models/user.proto" {
fmt.Fprintf(os.Stderr, "assertion 1 failed: expected %q, got %q\n", expected, res)
os.Exit(1)
}
}
// Assertion 2: pgs.JoinPaths normalizes relative paths resolving dot and dot-dot segments
{
res := pgs.JoinPaths("proto", "nested", "..", "pkg", ".", "service.proto")
expected := pgs.FilePath("proto/pkg/service.proto")
if res != expected || res.String() != "proto/pkg/service.proto" {
fmt.Fprintf(os.Stderr, "assertion 2 failed: expected %q, got %q\n", expected, res)
os.Exit(1)
}
}
// Assertion 3: pgs.JoinPaths handles empty string elements by omitting redundant separators
{
res := pgs.JoinPaths("proto", "", "models", "", "v1")
expected := pgs.FilePath("proto/models/v1")
if res != expected || res.String() != "proto/models/v1" {
fmt.Fprintf(os.Stderr, "assertion 3 failed: expected %q, got %q\n", expected, res)
os.Exit(1)
}
}
// Assertion 4: pgs.JoinPaths returns an empty FilePath when called with no arguments
{
res := pgs.JoinPaths()
expected := pgs.FilePath("")
if res != expected || res.String() != "" {
fmt.Fprintf(os.Stderr, "assertion 4 failed: expected empty FilePath, got %q\n", res)
os.Exit(1)
}
}
// Assertion 5: pgs.JoinPaths produces a FilePath type supporting Dir, Base, and Ext operations
{
res := pgs.JoinPaths("pkg", "api", "v1", "service.proto")
if res.Dir() != pgs.FilePath("pkg/api/v1") {
fmt.Fprintf(os.Stderr, "assertion 5 failed: Dir() expected 'pkg/api/v1', got %q\n", res.Dir())
os.Exit(1)
}
if res.Base() != "service.proto" {
fmt.Fprintf(os.Stderr, "assertion 5 failed: Base() expected 'service.proto', got %q\n", res.Base())
os.Exit(1)
}
if res.Ext() != ".proto" {
fmt.Fprintf(os.Stderr, "assertion 5 failed: Ext() expected '.proto', got %q\n", res.Ext())
os.Exit(1)
}
}
fmt.Println("All contract assertions passed successfully.")
}
Исходный сидер
аноним