CodeSampleX

Ejemplo

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

Muestra verificada para golang google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a: latlng.LatLng. El contrato se ejecutó en go 1.26 · linux…

sha256:b1c694820bf90210ab6d215014c2648cfb2ee1af1b176ae447c8cd7c4acf219f

Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido. Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas. MIT-0

Evidencia de ejecución

El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.

Base de evidencia
Contrato firmado aprobado
Recibos de verificación
1
Claves de firma que lo compilaron
1
Entorno declarado linux 24 · ubuntu · glibc 2.39 x64 go

Entornos de las ejecuciones de verificación

Entorno Contrato Etapas Ejecución
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

Caso

HOW
Objetivo
verify google.golang.org/genproto/googleapis/type/latlng.LatLng in pkg:golang/google.golang.org/genproto@v0.0.0-20191108220845-16a3f7862a1a
Paquetes
Símbolos
  • google.golang.org/genproto/googleapis/type/latlng.LatLng
Creado
2026-10-20T19:56:49Z

Contrato

  1. latlng.LatLng struct initializes Latitude and Longitude float64 fields and returns them via GetLatitude() and GetLongitude()
  2. latlng.LatLng.String() returns a non-empty formatted string and Reset() zeroes the fields
  3. nil *latlng.LatLng receiver safely returns 0 for GetLatitude() and GetLongitude()

Archivos

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

Descargar el artefacto de código fuente (tar.gz)

Código fuente

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 google.golang.org/genproto/googleapis/type/latlng.LatLng in 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
Demonstrate these symbols/APIs:
  - google.golang.org/genproto/googleapis/type/latlng.LatLng

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:be7b85532b1b1ebbe089cd363f0b8d9f849417c227cf4400205c433c5c3b7922","contract":["latlng.LatLng struct initializes Latitude and Longitude float64 fields and returns them via GetLatitude() and GetLongitude()","latlng.LatLng.String() returns a non-empty formatted string and Reset() zeroes the fields","nil *latlng.LatLng receiver safely returns 0 for GetLatitude() and GetLongitude()"],"goal":"verify google.golang.org/genproto/googleapis/type/latlng.LatLng in 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,"symbols":["google.golang.org/genproto/googleapis/type/latlng.LatLng"]},"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","symbols":["google.golang.org/genproto/googleapis/type/latlng.LatLng"],"verifierAdapter":"golang@1"}
go.mod
module 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 google.golang.org/genproto/googleapis/type/latlng.LatLng in 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"
  ],
  "symbols": [
    "google.golang.org/genproto/googleapis/type/latlng.LatLng"
  ]
}
test/contract.go
package main

import (
	"fmt"
	"os"

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

func main() {
	coord := &latlng.LatLng{
		Latitude:  37.7749,
		Longitude: -122.4194,
	}

	if coord.GetLatitude() != 37.7749 {
		fmt.Fprintf(os.Stderr, "expected latitude 37.7749, got %v\n", coord.GetLatitude())
		os.Exit(1)
	}
	if coord.GetLongitude() != -122.4194 {
		fmt.Fprintf(os.Stderr, "expected longitude -122.4194, got %v\n", coord.GetLongitude())
		os.Exit(1)
	}
	if coord.String() == "" {
		fmt.Fprintln(os.Stderr, "expected non-empty string representation")
		os.Exit(1)
	}

	coord.Reset()
	if coord.GetLatitude() != 0 || coord.GetLongitude() != 0 {
		fmt.Fprintln(os.Stderr, "expected Reset() to zero out fields")
		os.Exit(1)
	}

	var nilCoord *latlng.LatLng
	if nilCoord.GetLatitude() != 0 || nilCoord.GetLongitude() != 0 {
		fmt.Fprintln(os.Stderr, "expected zero values from nil receiver")
		os.Exit(1)
	}
}

Seeder de origen

anónimo