CodeSampleX

Beispiel

google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a

Verifiziertes Beispiel für golang google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a. Der Vertrag lief auf go 1.26 · linux debian/x64 · docker und…

sha256:302769df028d24171de039ff2d703f685e5c37875fa2d7ec790a4ecbeeccbbc9

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-10-20

Fall

HOW
Ziel
verify pkg:golang/google.golang.org/genproto@v0.0.0-20191108220845-16a3f7862a1a
Pakete
Erstellt
2026-10-20T18:05:32Z

Contract

  1. (*date.Date)(nil).GetYear(), GetMonth(), and GetDay() return 0 without panicking, and (*latlng.LatLng)(nil).GetLatitude() and GetLongitude() return 0 without panicking
  2. (*date.Date) getters return configured Year, Month, and Day values, String() formats year/month/day fields, Descriptor() returns non-empty descriptor bytes and index, and Reset() zeros all fields
  3. (*latlng.LatLng) getters return configured Latitude and Longitude values, String() formats latitude/longitude fields, Descriptor() returns non-empty descriptor bytes and index, and Reset() zeros all fields

Dateien

  • PROMPT.md
  • csx.json
  • go.mod
  • go.sum
  • spec.json
  • test/contract.go

Quellartefakt herunterladen (tar.gz)

Quelltext

PROMPT.md
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 pkg:golang/google.golang.org/genproto@v0.0.0-20191108220845-16a3f7862a1a
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:golang/google.golang.org/genproto@v0.0.0-20191108220845-16a3f7862a1a

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.
csx.json
{"case":{"caseId":"case:sha256:f711a2f0ccbc9d361b704265a7f7d2f1283a752516534b771658aa7f9269b791","contract":["(*date.Date)(nil).GetYear(), GetMonth(), and GetDay() return 0 without panicking, and (*latlng.LatLng)(nil).GetLatitude() and GetLongitude() return 0 without panicking","(*date.Date) getters return configured Year, Month, and Day values, String() formats year/month/day fields, Descriptor() returns non-empty descriptor bytes and index, and Reset() zeros all fields","(*latlng.LatLng) getters return configured Latitude and Longitude values, String() formats latitude/longitude fields, Descriptor() returns non-empty descriptor bytes and index, and Reset() zeros all fields"],"goal":"verify pkg:golang/google.golang.org/genproto@v0.0.0-20191108220845-16a3f7862a1a","kind":"HOW","packages":["pkg:golang/google.golang.org/genproto@v0.0.0-20191108220845-16a3f7862a1a"],"schemaVersion":1},"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/genproto@v0.0.0-20191108220845-16a3f7862a1a"],"schemaVersion":1,"subject":"pkg:golang/google.golang.org/genproto@v0.0.0-20191108220845-16a3f7862a1a","verifierAdapter":"golang@1"}
go.mod
module example.com/sample

go 1.21

require google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a

require github.com/golang/protobuf v1.3.2 // indirect
go.sum
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a h1:Ob5/580gVHBJZgXnff1cZDbG+xLtMVE5mDRTe+nIsX4=
google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:golang/google.golang.org/genproto@v0.0.0-20191108220845-16a3f7862a1a",
  "kind": "HOW",
  "packages": [
    "pkg:golang/google.golang.org/genproto@v0.0.0-20191108220845-16a3f7862a1a"
  ]
}
test/contract.go
package main

import (
	"fmt"
	"os"
	"strings"

	"google.golang.org/genproto/googleapis/type/date"
	"google.golang.org/genproto/googleapis/type/latlng"
)

func fail(msg string, args ...interface{}) {
	fmt.Fprintf(os.Stderr, msg+"\n", args...)
	os.Exit(1)
}

func main() {
	// 1. Nil receiver behavior on Date and LatLng getters
	var nilDate *date.Date
	if nilDate.GetYear() != 0 || nilDate.GetMonth() != 0 || nilDate.GetDay() != 0 {
		fail("expected nil Date getters to return 0")
	}

	var nilLatLng *latlng.LatLng
	if nilLatLng.GetLatitude() != 0 || nilLatLng.GetLongitude() != 0 {
		fail("expected nil LatLng getters to return 0")
	}

	// 2. Populated Date getters, String(), Descriptor(), and Reset()
	d := &date.Date{
		Year:  2019,
		Month: 11,
		Day:   8,
	}
	if d.GetYear() != 2019 || d.GetMonth() != 11 || d.GetDay() != 8 {
		fail("unexpected Date getter values: %v-%v-%v", d.GetYear(), d.GetMonth(), d.GetDay())
	}
	if s := d.String(); !strings.Contains(s, "year:2019") || !strings.Contains(s, "month:11") || !strings.Contains(s, "day:8") {
		fail("unexpected Date.String() output: %q", s)
	}
	if raw, idx := d.Descriptor(); len(raw) == 0 || len(idx) == 0 {
		fail("expected non-empty Descriptor bytes and index on Date")
	}
	d.Reset()
	if d.GetYear() != 0 || d.GetMonth() != 0 || d.GetDay() != 0 {
		fail("expected Date.Reset() to zero all fields")
	}

	// 3. Populated LatLng getters, String(), Descriptor(), and Reset()
	loc := &latlng.LatLng{
		Latitude:  37.422,
		Longitude: -122.084,
	}
	if loc.GetLatitude() != 37.422 || loc.GetLongitude() != -122.084 {
		fail("unexpected LatLng getter values: %v, %v", loc.GetLatitude(), loc.GetLongitude())
	}
	if s := loc.String(); !strings.Contains(s, "latitude:37.422") || !strings.Contains(s, "longitude:-122.084") {
		fail("unexpected LatLng.String() output: %q", s)
	}
	if raw, idx := loc.Descriptor(); len(raw) == 0 || len(idx) == 0 {
		fail("expected non-empty Descriptor bytes and index on LatLng")
	}
	loc.Reset()
	if loc.GetLatitude() != 0 || loc.GetLongitude() != 0 {
		fail("expected LatLng.Reset() to zero all fields")
	}
}

Ursprungs-Seeder

anonym