Sample
cloud.google.com/go/auth v0.18.2: Error
Verified sample for golang cloud.google.com/go/auth v0.18.2: Error. The contract ran on go 1.26 · linux debian/x64 · docker and passed.
sha256:3f5d89b0e9172bd36366108b45320eab61b94716fc284b07ae43a1473b05edfe
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 1
- Signing keys that built it
- 1
Declared environment
linux 24 · ubuntu · glibc 2.39 x64 go
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| 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-10 |
Case
HOW- Goal
- verify cloud.google.com/go/auth.Error in pkg:golang/cloud.google.com/go/auth@v0.18.2
- Packages
- Symbols
-
- cloud.google.com/go/auth.Error
- Created
- 2026-10-10T20:31:11Z
Contract
- auth.Error formats message containing HTTP status code and response body
- auth.Error Temporary returns true for transient HTTP status codes 408, 429, 500, and 503
- auth.Error Temporary returns false for non-transient HTTP status codes and nil response
- auth.Error Unwrap returns the underlying wrapped error
Files
- PROMPT.md
- csx.json
- go.mod
- go.sum
- main.go
- spec.json
- test/contract.go
Source
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 cloud.google.com/go/auth.Error in pkg:golang/cloud.google.com/go/auth@v0.18.2
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/cloud.google.com/go/auth@v0.18.2
Demonstrate these symbols/APIs:
- cloud.google.com/go/auth.Error
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:820affa93a5c0c49f233dc86abbb8dec73e5438d612e8abc4c15facdf07fa0b8","contract":["auth.Error formats message containing HTTP status code and response body","auth.Error Temporary returns true for transient HTTP status codes 408, 429, 500, and 503","auth.Error Temporary returns false for non-transient HTTP status codes and nil response","auth.Error Unwrap returns the underlying wrapped error"],"goal":"verify cloud.google.com/go/auth.Error in pkg:golang/cloud.google.com/go/auth@v0.18.2","kind":"HOW","packages":["pkg:golang/cloud.google.com/go/auth@v0.18.2"],"schemaVersion":1,"symbols":["cloud.google.com/go/auth.Error"]},"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/cloud.google.com/go/auth@v0.18.2"],"schemaVersion":1,"subject":"pkg:golang/cloud.google.com/go/auth@v0.18.2","symbols":["cloud.google.com/go/auth.Error"],"verifierAdapter":"golang@1"}
module sample
go 1.26.6
require cloud.google.com/go/auth v0.18.2
require (
cloud.google.com/go/compute/metadata v0.9.0 // indirect
github.com/googleapis/gax-go/v2 v2.17.0 // indirect
golang.org/x/sys v0.40.0 // indirect
)
cloud.google.com/go/auth v0.18.2 h1:+Nbt5Ev0xEqxlNjd6c+yYUeosQ5TtEUaNcN/3FozlaM=
cloud.google.com/go/auth v0.18.2/go.mod h1:xD+oY7gcahcu7G2SG2DsBerfFxgPAJz17zz2joOFF3M=
cloud.google.com/go/compute/metadata v0.9.0 h1:pDUj4QMoPejqq20dK0Pg2N4yG9zIkYGdBtwLoEkH9Zs=
cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCBSM6qQI1yTBdEb3C10=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
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/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/s2a-go v0.1.9 h1:LGD7gtMgezd8a/Xak7mEWL0PjoTQFvpRudN895yqKW0=
github.com/google/s2a-go v0.1.9/go.mod h1:YA0Ei2ZQL3acow2O62kdp9UlnvMmU7kA6Eutn0dXayM=
github.com/googleapis/enterprise-certificate-proxy v0.3.11 h1:vAe81Msw+8tKUxi2Dqh/NZMz7475yUvmRIkXr4oN2ao=
github.com/googleapis/enterprise-certificate-proxy v0.3.11/go.mod h1:RFV7MUdlb7AgEq2v7FmMCfeSMCllAzWxFgRdusoGks8=
github.com/googleapis/gax-go/v2 v2.17.0 h1:RksgfBpxqff0EZkDWYuz9q/uWsTVz+kf43LsZ1J6SMc=
github.com/googleapis/gax-go/v2 v2.17.0/go.mod h1:mzaqghpQp4JDh3HvADwrat+6M3MOIDp5YKHhb9PAgDY=
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 h1:F7Jx+6hwnZ41NSFTO5q4LYDtJRXBf2PD0rNBkeB/lus=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0/go.mod h1:UHB22Z8QsdRDrnAtX4PntOl36ajSxcdUMt1sF7Y6E7Q=
go.opentelemetry.io/otel v1.39.0 h1:8yPrr/S0ND9QEfTfdP9V+SiwT4E0G7Y5MO7p85nis48=
go.opentelemetry.io/otel v1.39.0/go.mod h1:kLlFTywNWrFyEdH0oj2xK0bFYZtHRYUdv1NklR/tgc8=
go.opentelemetry.io/otel/metric v1.39.0 h1:d1UzonvEZriVfpNKEVmHXbdf909uGTOQjA0HF0Ls5Q0=
go.opentelemetry.io/otel/metric v1.39.0/go.mod h1:jrZSWL33sD7bBxg1xjrqyDjnuzTUB0x1nBERXd7Ftcs=
go.opentelemetry.io/otel/trace v1.39.0 h1:2d2vfpEDmCJ5zVYz7ijaJdOF59xLomrvj7bjt6/qCJI=
go.opentelemetry.io/otel/trace v1.39.0/go.mod h1:88w4/PnZSazkGzz/w84VHpQafiU4EtqqlVdxWy+rNOA=
golang.org/x/crypto v0.47.0 h1:V6e3FRj+n4dbpw86FJ8Fv7XVOql7TEwpHapKoMJ/GO8=
golang.org/x/crypto v0.47.0/go.mod h1:ff3Y9VzzKbwSSEzWqJsJVBnWmRwRSHt/6Op5n9bQc4A=
golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o=
golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8=
golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ=
golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/text v0.33.0 h1:B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE=
golang.org/x/text v0.33.0/go.mod h1:LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8=
google.golang.org/genproto v0.0.0-20260128011058-8636f8732409 h1:VQZ/yAbAtjkHgH80teYd2em3xtIkkHd7ZhqfH2N9CsM=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 h1:H86B94AW+VfJWDqFeEbBPhEtHzJwJfTbgE2lZa54ZAQ=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409/go.mod h1:j9x/tPzZkyxcgEFkiKEEGxfvyumM01BEtsW8xzOahRQ=
google.golang.org/grpc v1.78.0 h1:K1XZG/yGDJnzMdd/uZHAkVqJE+xIDOcmdSFZkBUicNc=
google.golang.org/grpc v1.78.0/go.mod h1:I47qjTo4OKbMkjA/aOOwxDIiPSBofUtQUI5EfpWvW7U=
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 (
"errors"
"fmt"
"net/http"
"cloud.google.com/go/auth"
)
func main() {
underlying := errors.New("connection reset by peer")
authErr := &auth.Error{
Response: &http.Response{
StatusCode: http.StatusServiceUnavailable,
Status: "503 Service Unavailable",
},
Body: []byte(`{"error": "temporarily_unavailable"}`),
Err: underlying,
}
fmt.Printf("Auth error: %s\n", authErr.Error())
fmt.Printf("Is temporary: %t\n", authErr.Temporary())
if errors.Is(authErr, underlying) {
fmt.Println("Underlying error matched via errors.Is")
}
}
{
"schemaVersion": 1,
"goal": "verify cloud.google.com/go/auth.Error in pkg:golang/cloud.google.com/go/auth@v0.18.2",
"kind": "HOW",
"packages": [
"pkg:golang/cloud.google.com/go/auth@v0.18.2"
],
"symbols": [
"cloud.google.com/go/auth.Error"
]
}
package main
import (
"errors"
"fmt"
"net/http"
"os"
"cloud.google.com/go/auth"
)
func main() {
// Assertion 1: auth.Error formats message containing HTTP status code and response body
{
resp := &http.Response{
StatusCode: http.StatusBadRequest,
Status: "400 Bad Request",
}
body := []byte(`{"error":"invalid_grant"}`)
err := &auth.Error{
Response: resp,
Body: body,
}
expected := "auth: cannot fetch token: 400\nResponse: {\"error\":\"invalid_grant\"}"
if err.Error() != expected {
fmt.Fprintf(os.Stderr, "Assertion 1 failed: expected %q, got %q\n", expected, err.Error())
os.Exit(1)
}
}
// Assertion 2: auth.Error Temporary returns true for transient HTTP status codes 408, 429, 500, and 503
{
transientCodes := []int{
http.StatusRequestTimeout, // 408
http.StatusTooManyRequests, // 429
http.StatusInternalServerError, // 500
http.StatusServiceUnavailable, // 503
}
for _, code := range transientCodes {
err := &auth.Error{
Response: &http.Response{
StatusCode: code,
},
}
if !err.Temporary() {
fmt.Fprintf(os.Stderr, "Assertion 2 failed: expected Temporary()=true for status %d\n", code)
os.Exit(1)
}
}
}
// Assertion 3: auth.Error Temporary returns false for non-transient HTTP status codes and nil response
{
nonTransientCodes := []int{
http.StatusOK, // 200
http.StatusBadRequest, // 400
http.StatusUnauthorized, // 401
http.StatusForbidden, // 403
http.StatusNotFound, // 404
http.StatusTeapot, // 418
}
for _, code := range nonTransientCodes {
err := &auth.Error{
Response: &http.Response{
StatusCode: code,
},
}
if err.Temporary() {
fmt.Fprintf(os.Stderr, "Assertion 3 failed: expected Temporary()=false for status %d\n", code)
os.Exit(1)
}
}
nilRespErr := &auth.Error{
Response: nil,
}
if nilRespErr.Temporary() {
fmt.Fprintf(os.Stderr, "Assertion 3 failed: expected Temporary()=false for nil Response\n")
os.Exit(1)
}
}
// Assertion 4: auth.Error Unwrap returns the underlying wrapped error
{
underlying := errors.New("underlying network failure")
err := &auth.Error{
Response: &http.Response{
StatusCode: http.StatusBadGateway,
},
Body: []byte("bad gateway"),
Err: underlying,
}
if err.Unwrap() != underlying {
fmt.Fprintf(os.Stderr, "Assertion 4 failed: expected Unwrap() to return underlying error\n")
os.Exit(1)
}
if !errors.Is(err, underlying) {
fmt.Fprintf(os.Stderr, "Assertion 4 failed: expected errors.Is(err, underlying) to be true\n")
os.Exit(1)
}
}
fmt.Println("PASS: all cloud.google.com/go/auth.Error contract assertions passed")
}
Origin Seeder
anonymous