CodeSampleX

Exemple

github.com/aws/aws-sdk-go-v2 v1.41.7: aws.LogSigning

Échantillon vérifié pour golang github.com/aws/aws-sdk-go-v2 v1.41.7: aws.LogSigning. Le contrat s'est exécuté sur go 1.26 · linux debian/x64 · docker et a…

sha256:fabb2630420cef8fbe5017150869d66c9f17a585eb6167f972cea7c12999a81e

Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré. Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes. MIT-0

Preuves d'exécution

L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.

Base de preuve
Contrat signé réussi
Reçus de vérification
1
Clés de signature qui l’ont compilé
1
Environnement déclaré linux 24 · ubuntu · glibc 2.39 x64 go

Environnements des exécutions de vérification

Environnement Contrat Étapes Exécution
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-09

Cas

HOW
Objectif
verify github.com/aws/aws-sdk-go-v2/aws.LogSigning in pkg:golang/github.com/aws/aws-sdk-go-v2@v1.41.7
Paquets
Symboles
  • github.com/aws/aws-sdk-go-v2/aws.LogSigning
Créé
2026-10-09T17:48:02Z

Contrat

  1. aws.LogSigning is a non-zero ClientLogMode flag bit
  2. aws.ClientLogMode.IsSigning returns true when aws.LogSigning is set
  3. aws.ClientLogMode.IsSigning returns false when aws.LogSigning is not set
  4. aws.ClientLogMode.ClearSigning clears the aws.LogSigning flag bit

Fichiers

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

Télécharger l’artefact source (tar.gz)

Code source

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 github.com/aws/aws-sdk-go-v2/aws.LogSigning in pkg:golang/github.com/aws/aws-sdk-go-v2@v1.41.7
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:golang/github.com/aws/aws-sdk-go-v2@v1.41.7
Demonstrate these symbols/APIs:
  - github.com/aws/aws-sdk-go-v2/aws.LogSigning

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:eb9ca11fb3ea843c6b269aa9b660514c44623cd5c0f46ab687053803a2736923","contract":["aws.LogSigning is a non-zero ClientLogMode flag bit","aws.ClientLogMode.IsSigning returns true when aws.LogSigning is set","aws.ClientLogMode.IsSigning returns false when aws.LogSigning is not set","aws.ClientLogMode.ClearSigning clears the aws.LogSigning flag bit"],"goal":"verify github.com/aws/aws-sdk-go-v2/aws.LogSigning in pkg:golang/github.com/aws/aws-sdk-go-v2@v1.41.7","kind":"HOW","packages":["pkg:golang/github.com/aws/aws-sdk-go-v2@v1.41.7"],"schemaVersion":1,"symbols":["github.com/aws/aws-sdk-go-v2/aws.LogSigning"]},"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/github.com/aws/aws-sdk-go-v2@v1.41.7"],"schemaVersion":1,"subject":"pkg:golang/github.com/aws/aws-sdk-go-v2@v1.41.7","symbols":["github.com/aws/aws-sdk-go-v2/aws.LogSigning"],"verifierAdapter":"golang@1"}
go.mod
module sample

go 1.26.6

require github.com/aws/aws-sdk-go-v2 v1.41.7

require github.com/aws/smithy-go v1.25.1 // indirect
go.sum
github.com/aws/aws-sdk-go-v2 v1.41.7 h1:DWpAJt66FmnnaRIOT/8ASTucrvuDPZASqhhLey6tLY8=
github.com/aws/aws-sdk-go-v2 v1.41.7/go.mod h1:4LAfZOPHNVNQEckOACQx60Y8pSRjIkNZQz1w92xpMJc=
github.com/aws/smithy-go v1.25.1 h1:J8ERsGSU7d+aCmdQur5Txg6bVoYelvQJgtZehD12GkI=
github.com/aws/smithy-go v1.25.1/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc=
main.go
package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go-v2/aws"
)

func main() {
	var mode aws.ClientLogMode = aws.LogSigning | aws.LogRetries
	fmt.Printf("LogSigning enabled: %t\n", mode.IsSigning())
	mode.ClearSigning()
	fmt.Printf("LogSigning after clear: %t\n", mode.IsSigning())
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify github.com/aws/aws-sdk-go-v2/aws.LogSigning in pkg:golang/github.com/aws/aws-sdk-go-v2@v1.41.7",
  "kind": "HOW",
  "packages": [
    "pkg:golang/github.com/aws/aws-sdk-go-v2@v1.41.7"
  ],
  "symbols": [
    "github.com/aws/aws-sdk-go-v2/aws.LogSigning"
  ]
}
test/contract.go
package main

import (
	"fmt"
	"os"

	"github.com/aws/aws-sdk-go-v2/aws"
)

func main() {
	// Assertion 1: aws.LogSigning is a non-zero ClientLogMode flag bit
	{
		if aws.LogSigning == 0 {
			fmt.Fprintf(os.Stderr, "Assertion 1 failed: LogSigning should be non-zero\n")
			os.Exit(1)
		}
	}

	// Assertion 2: aws.ClientLogMode.IsSigning returns true when aws.LogSigning is set
	{
		mode := aws.LogSigning
		if !mode.IsSigning() {
			fmt.Fprintf(os.Stderr, "Assertion 2 failed: expected IsSigning() to be true for LogSigning\n")
			os.Exit(1)
		}

		combined := aws.LogSigning | aws.LogRetries
		if !combined.IsSigning() {
			fmt.Fprintf(os.Stderr, "Assertion 2 failed: expected IsSigning() to be true for combined mode\n")
			os.Exit(1)
		}
	}

	// Assertion 3: aws.ClientLogMode.IsSigning returns false when aws.LogSigning is not set
	{
		var zeroMode aws.ClientLogMode
		if zeroMode.IsSigning() {
			fmt.Fprintf(os.Stderr, "Assertion 3 failed: expected zero mode IsSigning() to be false\n")
			os.Exit(1)
		}

		otherMode := aws.LogRetries | aws.LogRequest
		if otherMode.IsSigning() {
			fmt.Fprintf(os.Stderr, "Assertion 3 failed: expected otherMode IsSigning() to be false\n")
			os.Exit(1)
		}
	}

	// Assertion 4: aws.ClientLogMode.ClearSigning clears the aws.LogSigning flag bit
	{
		mode := aws.LogSigning | aws.LogRetries
		mode.ClearSigning()
		if mode.IsSigning() {
			fmt.Fprintf(os.Stderr, "Assertion 4 failed: expected IsSigning() to be false after ClearSigning\n")
			os.Exit(1)
		}
		if mode&aws.LogSigning != 0 {
			fmt.Fprintf(os.Stderr, "Assertion 4 failed: LogSigning bit still set after ClearSigning\n")
			os.Exit(1)
		}
		if !mode.IsRetries() {
			fmt.Fprintf(os.Stderr, "Assertion 4 failed: LogRetries should remain set after ClearSigning\n")
			os.Exit(1)
		}
	}

	fmt.Println("PASS: all aws.LogSigning contract assertions passed")
}

Seeder d'origine

anonyme