CodeSampleX

샘플

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

검증된 샘플 — golang google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a: date.Date. go 1.26 · linux debian/x64 · docker에서 contract를 실행해 통과했습니다.

sha256:5b808f15cbedadd6d82be8d3225cd354914f37bba0dadc4753f4b3c0f2a8a7ee

이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다. 통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다. MIT-0

실행 증거

선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.

증거 기준
서명된 컨트랙트 통과
검증 영수증
1
빌드한 서명 키
1
선언된 환경 linux 24 · ubuntu · glibc 2.39 x64 go

검증 실행 환경

환경 컨트랙트 단계 실행일
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

케이스

HOW
목표
verify google.golang.org/genproto/googleapis/type/date.Date in pkg:golang/google.golang.org/genproto@v0.0.0-20191108220845-16a3f7862a1a
패키지
심벌
  • google.golang.org/genproto/googleapis/type/date.Date
생성일
2026-10-20T19:07:03Z

컨트랙트

  1. date.Date{Year: 2024, Month: 2, Day: 29} returns 2024, 2, 29 from GetYear(), GetMonth(), and GetDay()
  2. date.Date{Year: 0, Month: 12, Day: 25} supports partial dates with zero year
  3. (*date.Date).Descriptor() returns non-empty descriptor bytes and Reset() zeros Year, Month, and Day
  4. (*date.Date)(nil) returns 0 from GetYear(), GetMonth(), and GetDay() without panicking

파일

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

소스 아티팩트 내려받기 (tar.gz)

소스

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/date.Date 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/date.Date

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:52f5e56835722ae6bd1c982b43f1397c8cf472d96475489c17a3bc3c8a34bfa2","contract":["date.Date{Year: 2024, Month: 2, Day: 29} returns 2024, 2, 29 from GetYear(), GetMonth(), and GetDay()","date.Date{Year: 0, Month: 12, Day: 25} supports partial dates with zero year","(*date.Date).Descriptor() returns non-empty descriptor bytes and Reset() zeros Year, Month, and Day","(*date.Date)(nil) returns 0 from GetYear(), GetMonth(), and GetDay() without panicking"],"goal":"verify google.golang.org/genproto/googleapis/type/date.Date 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/date.Date"]},"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/date.Date"],"verifierAdapter":"golang@1"}
go.mod
module example.com/sample

go 1.20

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/date.Date 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/date.Date"
  ]
}
test/contract.go
package main

import (
	"fmt"
	"os"
	"strings"

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

func main() {
	full := &date.Date{
		Year:  2024,
		Month: 2,
		Day:   29,
	}
	if full.GetYear() != 2024 || full.GetMonth() != 2 || full.GetDay() != 29 {
		fmt.Fprintf(os.Stderr, "unexpected full date values: %v\n", full)
		os.Exit(1)
	}
	s := full.String()
	if !strings.Contains(s, "year:2024") || !strings.Contains(s, "month:2") || !strings.Contains(s, "day:29") {
		fmt.Fprintf(os.Stderr, "unexpected string representation: %q\n", s)
		os.Exit(1)
	}

	desc, idx := full.Descriptor()
	if len(desc) == 0 || len(idx) != 1 || idx[0] != 0 {
		fmt.Fprintf(os.Stderr, "unexpected descriptor: len(desc)=%d, idx=%v\n", len(desc), idx)
		os.Exit(1)
	}

	partial := &date.Date{
		Year:  0,
		Month: 12,
		Day:   25,
	}
	if partial.GetYear() != 0 || partial.GetMonth() != 12 || partial.GetDay() != 25 {
		fmt.Fprintf(os.Stderr, "unexpected partial date values: %v\n", partial)
		os.Exit(1)
	}

	full.Reset()
	if full.GetYear() != 0 || full.GetMonth() != 0 || full.GetDay() != 0 {
		fmt.Fprintf(os.Stderr, "expected Reset() to clear fields, got: %v\n", full)
		os.Exit(1)
	}

	var nilDate *date.Date
	if nilDate.GetYear() != 0 || nilDate.GetMonth() != 0 || nilDate.GetDay() != 0 {
		fmt.Fprintln(os.Stderr, "expected nil receiver getters to return 0")
		os.Exit(1)
	}
}

오리진 시더

익명