Beispiel
google.golang.org/grpc v1.75.1: NewClient
Verifiziertes Beispiel für golang google.golang.org/grpc v1.75.1: NewClient. Der Vertrag lief auf go 1.26 · linux debian/x64 · docker und bestand.
sha256:a7106adc49bad7fdcfb717671ec734d1a37fed94cf1a6b3e77c4651a18cbc960
Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen.
Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen.
MIT-0
Ausführungsbelege
Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.
- Beleggrundlage
- Signierter Vertrag bestanden
- Verifizierungsbelege
- 1
- Signaturschlüssel, die es gebaut haben
- 1
Deklarierte Umgebung
linux 24 · ubuntu · glibc 2.39 x64 go
Umgebungen der Verifizierungsläufe
| Umgebung | Contract | Stufen | Lauf |
|---|---|---|---|
| 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-09-14 |
Fall
HOW- Ziel
- verify grpc.NewClient in pkg:golang/google.golang.org/grpc@v1.75.1
- Symbole
-
- grpc.NewClient
- Erstellt
- 2026-09-14T21:40:21Z
Contract
- grpc.NewClient creates a ClientConn for a valid target when transport credentials are provided
- grpc.NewClient sets Target matching the provided target URI
- grpc.NewClient initializes connection in Idle connectivity state without connecting immediately
- grpc.NewClient returns an error if no transport credentials or credentials bundle is configured
- grpc.NewClient creates a connection that closes cleanly without error
Dateien
- PROMPT.md
- csx.json
- go.mod
- go.sum
- main.go
- spec.json
- test/contract.go
Quelltext
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 grpc.NewClient in pkg:golang/google.golang.org/grpc@v1.75.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/google.golang.org/grpc@v1.75.1
Demonstrate these symbols/APIs:
- grpc.NewClient
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:e8574be78675fab0791589b65d131af7aff33a07a5b2a9fcfc002b75ac926071","contract":["grpc.NewClient creates a ClientConn for a valid target when transport credentials are provided","grpc.NewClient sets Target matching the provided target URI","grpc.NewClient initializes connection in Idle connectivity state without connecting immediately","grpc.NewClient returns an error if no transport credentials or credentials bundle is configured","grpc.NewClient creates a connection that closes cleanly without error"],"goal":"verify grpc.NewClient in pkg:golang/google.golang.org/grpc@v1.75.1","kind":"HOW","packages":["pkg:golang/google.golang.org/grpc@v1.75.1"],"schemaVersion":1,"symbols":["grpc.NewClient"]},"contractCommand":["go","run","./test"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"golang","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"go","schemaVersion":1},"license":"MIT-0","packages":["pkg:golang/google.golang.org/grpc@v1.75.1"],"schemaVersion":1,"subject":"pkg:golang/google.golang.org/grpc@v1.75.1","symbols":["grpc.NewClient"],"verifierAdapter":"golang@1"}
module sample
go 1.25.0
require google.golang.org/grpc v1.75.1
require (
golang.org/x/net v0.58.0 // indirect
golang.org/x/sys v0.47.0 // indirect
golang.org/x/text v0.41.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa // indirect
google.golang.org/protobuf v1.36.11 // indirect
)
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ=
go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I=
go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE=
go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E=
go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI=
go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg=
go.opentelemetry.io/otel/sdk/metric v1.37.0 h1:90lI228XrB9jCMuSdA0673aubgRobVZFhbjxHHspCPc=
go.opentelemetry.io/otel/sdk/metric v1.37.0/go.mod h1:cNen4ZWfiD37l5NhS+Keb5RXVWZWpRE+9WyVCpbo5ps=
go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4=
go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0=
golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To=
golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU=
golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs=
golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8=
golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M=
gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk=
gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa h1:mZHHdPZl0dbGHCflZgAq/Q468DWVFcU2whhB2KAo8fk=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
google.golang.org/grpc v1.75.1 h1:/ODCNEuf9VghjgO3rqLcfg8fiOP0nSluljWFlDxELLI=
google.golang.org/grpc v1.75.1/go.mod h1:JtPAzKiq4v1xcAB2hydNlWI2RnF85XXcV0mhKXr2ecQ=
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
package main
import (
"fmt"
"log"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
)
func main() {
conn, err := grpc.NewClient("passthrough:///localhost:50051", grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
log.Fatalf("failed to create gRPC client: %v", err)
}
defer conn.Close()
fmt.Printf("gRPC client created for target: %s\n", conn.Target())
}
{
"schemaVersion": 1,
"goal": "verify grpc.NewClient in pkg:golang/google.golang.org/grpc@v1.75.1",
"kind": "HOW",
"packages": [
"pkg:golang/google.golang.org/grpc@v1.75.1"
],
"symbols": [
"grpc.NewClient"
]
}
package main
import (
"fmt"
"os"
"strings"
"google.golang.org/grpc"
"google.golang.org/grpc/connectivity"
"google.golang.org/grpc/credentials/insecure"
)
func main() {
// Assertion 1: grpc.NewClient creates a ClientConn for a valid target when transport credentials are provided
target := "passthrough:///localhost:50051"
conn, err := grpc.NewClient(target, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
fmt.Fprintf(os.Stderr, "assertion 1 failed: grpc.NewClient returned error: %v\n", err)
os.Exit(1)
}
if conn == nil {
fmt.Fprintf(os.Stderr, "assertion 1 failed: expected non-nil ClientConn\n")
os.Exit(1)
}
// Assertion 2: grpc.NewClient sets Target matching the provided target URI
if gotTarget := conn.Target(); gotTarget != target {
fmt.Fprintf(os.Stderr, "assertion 2 failed: expected target %q, got %q\n", target, gotTarget)
os.Exit(1)
}
// Assertion 3: grpc.NewClient initializes connection in Idle connectivity state without connecting immediately
if state := conn.GetState(); state != connectivity.Idle {
fmt.Fprintf(os.Stderr, "assertion 3 failed: expected connectivity.Idle, got %v\n", state)
os.Exit(1)
}
// Assertion 4: grpc.NewClient returns an error if no transport credentials or credentials bundle is configured
_, errNoCreds := grpc.NewClient("localhost:50051")
if errNoCreds == nil {
fmt.Fprintf(os.Stderr, "assertion 4 failed: expected error when credentials are missing, got nil\n")
os.Exit(1)
}
if !strings.Contains(errNoCreds.Error(), "no transport security set") {
fmt.Fprintf(os.Stderr, "assertion 4 failed: unexpected error message: %v\n", errNoCreds)
os.Exit(1)
}
// Assertion 5: grpc.NewClient creates a connection that closes cleanly without error
if err := conn.Close(); err != nil {
fmt.Fprintf(os.Stderr, "assertion 5 failed: conn.Close returned error: %v\n", err)
os.Exit(1)
}
fmt.Println("All grpc.NewClient contract assertions passed successfully.")
}
Ursprungs-Seeder
anonym