Beispiel
golang.org/x/text v0.42.0: encoding.Nop
Verifiziertes Beispiel für golang golang.org/x/text v0.42.0: encoding.Nop. Der Vertrag lief auf go 1.26 · linux debian/x64 · docker und bestand.
sha256:e1aac7a48a1039b506efca74be1858514422c3485143654ef60d0014925a36e1
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
go 1.26 linux 24 · ubuntu · glibc 2.39 x64 go 1.26 go go 1
Umgebungen der Verifizierungsläufe
| Umgebung | Contract | Stufen | Lauf |
|---|---|---|---|
| go 1.26 · linux debian/x64 · docker ed25519:d91480838ac982c9 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · golang@1golang:1.26@sha256:e30143be198a… |
2026-09-15 |
Fall
HOW- Ziel
- verify golang.org/x/text/encoding.Nop in pkg:golang/golang.org/x/text@v0.42.0
- Pakete
- Symbole
-
- golang.org/x/text/encoding.Nop
- Umgebung
- go 1.26.6
- Erstellt
- 2026-09-15T21:22:28Z
Contract
- encoding.Nop.NewDecoder returns a Decoder whose Bytes and String methods preserve input bytes and strings unchanged
- encoding.Nop.NewEncoder returns an Encoder whose Bytes and String methods preserve input bytes and strings unchanged
- encoding.Nop decoder and encoder pass invalid UTF-8 byte sequences through without error or replacement
- encoding.Nop.NewDecoder Reader wraps an io.Reader and reads the underlying byte stream unchanged
- encoding.Nop.NewEncoder Writer wraps an io.Writer and writes the byte stream unchanged
Dateien
- PROMPT.md
- csx.json
- go.mod
- go.sum
- main.go
- spec.json
- test/contract.go
Quelltext
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 golang.org/x/text/encoding.Nop in pkg:golang/golang.org/x/text@v0.42.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/golang.org/x/text@v0.42.0
Demonstrate these symbols/APIs:
- golang.org/x/text/encoding.Nop
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:7b0988dc655982b79194de8755a57e126321b09967164ba301b13fdb84a50387","contract":["encoding.Nop.NewDecoder returns a Decoder whose Bytes and String methods preserve input bytes and strings unchanged","encoding.Nop.NewEncoder returns an Encoder whose Bytes and String methods preserve input bytes and strings unchanged","encoding.Nop decoder and encoder pass invalid UTF-8 byte sequences through without error or replacement","encoding.Nop.NewDecoder Reader wraps an io.Reader and reads the underlying byte stream unchanged","encoding.Nop.NewEncoder Writer wraps an io.Writer and writes the byte stream unchanged"],"goal":"verify golang.org/x/text/encoding.Nop in pkg:golang/golang.org/x/text@v0.42.0","kind":"HOW","packages":["pkg:golang/golang.org/x/text@v0.42.0"],"schemaVersion":1,"symbols":["golang.org/x/text/encoding.Nop"]},"contractCommand":["go","run","./test"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"golang","language":"go","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"go","packageManagerVersion":"1.26.6","runtime":"go","runtimeVersion":"1.26.6","schemaVersion":1},"license":"MIT-0","packages":["pkg:golang/golang.org/x/text@v0.42.0"],"schemaVersion":1,"subject":"pkg:golang/golang.org/x/text@v0.42.0","symbols":["golang.org/x/text/encoding.Nop"],"verifierAdapter":"golang@1"}
module sample
go 1.26.6
require golang.org/x/text v0.42.0
golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI=
golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E=
package main
import (
"bytes"
"fmt"
"io"
"strings"
"golang.org/x/text/encoding"
)
func main() {
// Demonstrating golang.org/x/text/encoding.Nop
// encoding.Nop is the nop encoding whose transformed bytes are identical to source bytes.
// 1. Using NewDecoder to decode bytes and strings
decoder := encoding.Nop.NewDecoder()
decodedBytes, err := decoder.Bytes([]byte("Hello, World!"))
if err != nil {
fmt.Printf("Decode error: %v\n", err)
return
}
fmt.Printf("Decoded bytes: %s\n", string(decodedBytes))
decodedStr, err := decoder.String("Sample text: 12345")
if err != nil {
fmt.Printf("Decode string error: %v\n", err)
return
}
fmt.Printf("Decoded string: %s\n", decodedStr)
// 2. Using NewEncoder to encode bytes and strings
encoder := encoding.Nop.NewEncoder()
encodedBytes, err := encoder.Bytes([]byte("Sample payload"))
if err != nil {
fmt.Printf("Encode error: %v\n", err)
return
}
fmt.Printf("Encoded bytes: %s\n", string(encodedBytes))
encodedStr, err := encoder.String("Encoded string text")
if err != nil {
fmt.Printf("Encode string error: %v\n", err)
return
}
fmt.Printf("Encoded string: %s\n", encodedStr)
// 3. Streaming with Reader and Writer
reader := decoder.Reader(strings.NewReader("Stream content through Nop decoder"))
streamResult, err := io.ReadAll(reader)
if err != nil {
fmt.Printf("Reader stream error: %v\n", err)
return
}
fmt.Printf("Reader stream output: %s\n", string(streamResult))
var buf bytes.Buffer
writer := encoder.Writer(&buf)
_, err = writer.Write([]byte("Stream content through Nop encoder"))
if err != nil {
fmt.Printf("Writer stream error: %v\n", err)
return
}
fmt.Printf("Writer stream output: %s\n", buf.String())
// 4. Invalid UTF-8 bytes are preserved without modification
rawSeq := []byte{0xff, 0xfe, 0xfd}
passthrough, err := decoder.Bytes(rawSeq)
if err != nil {
fmt.Printf("Invalid UTF-8 passthrough error: %v\n", err)
return
}
fmt.Printf("Invalid sequence length preserved: %d\n", len(passthrough))
fmt.Println("golang.org/x/text/encoding.Nop demonstrated successfully.")
}
{
"schemaVersion": 1,
"goal": "verify golang.org/x/text/encoding.Nop in pkg:golang/golang.org/x/text@v0.42.0",
"kind": "HOW",
"packages": [
"pkg:golang/golang.org/x/text@v0.42.0"
],
"symbols": [
"golang.org/x/text/encoding.Nop"
]
}
package main
import (
"bytes"
"fmt"
"io"
"os"
"strings"
"golang.org/x/text/encoding"
)
func main() {
// Assertion 1: encoding.Nop.NewDecoder returns a Decoder whose Bytes and String methods preserve input bytes and strings unchanged
{
decoder := encoding.Nop.NewDecoder()
if decoder == nil {
fmt.Fprintf(os.Stderr, "assertion 1 failed: NewDecoder returned nil\n")
os.Exit(1)
}
inputBytes := []byte("Standard UTF-8 text for decoding: 12345 @#$")
outBytes, err := decoder.Bytes(inputBytes)
if err != nil {
fmt.Fprintf(os.Stderr, "assertion 1 failed: Bytes returned error: %v\n", err)
os.Exit(1)
}
if !bytes.Equal(outBytes, inputBytes) {
fmt.Fprintf(os.Stderr, "assertion 1 failed: Bytes did not preserve input byte slice\n")
os.Exit(1)
}
inputStr := "Sample string value with unicode: 你好 세계"
outStr, err := decoder.String(inputStr)
if err != nil {
fmt.Fprintf(os.Stderr, "assertion 1 failed: String returned error: %v\n", err)
os.Exit(1)
}
if outStr != inputStr {
fmt.Fprintf(os.Stderr, "assertion 1 failed: String did not preserve input string\n")
os.Exit(1)
}
}
// Assertion 2: encoding.Nop.NewEncoder returns an Encoder whose Bytes and String methods preserve input bytes and strings unchanged
{
encoder := encoding.Nop.NewEncoder()
if encoder == nil {
fmt.Fprintf(os.Stderr, "assertion 2 failed: NewEncoder returned nil\n")
os.Exit(1)
}
inputBytes := []byte("Standard UTF-8 text for encoding: 67890 %^&*")
outBytes, err := encoder.Bytes(inputBytes)
if err != nil {
fmt.Fprintf(os.Stderr, "assertion 2 failed: Bytes returned error: %v\n", err)
os.Exit(1)
}
if !bytes.Equal(outBytes, inputBytes) {
fmt.Fprintf(os.Stderr, "assertion 2 failed: Bytes did not preserve input byte slice\n")
os.Exit(1)
}
inputStr := "Sample encoded string: Привет мир"
outStr, err := encoder.String(inputStr)
if err != nil {
fmt.Fprintf(os.Stderr, "assertion 2 failed: String returned error: %v\n", err)
os.Exit(1)
}
if outStr != inputStr {
fmt.Fprintf(os.Stderr, "assertion 2 failed: String did not preserve input string\n")
os.Exit(1)
}
}
// Assertion 3: encoding.Nop decoder and encoder pass invalid UTF-8 byte sequences through without error or replacement
{
decoder := encoding.Nop.NewDecoder()
encoder := encoding.Nop.NewEncoder()
// Invalid UTF-8 byte sequence
invalidBytes := []byte{0xff, 0xfe, 0x80, 0xc0, 0xaf, 0x00}
decOut, err := decoder.Bytes(invalidBytes)
if err != nil {
fmt.Fprintf(os.Stderr, "assertion 3 failed: decoder returned error on invalid UTF-8: %v\n", err)
os.Exit(1)
}
if !bytes.Equal(decOut, invalidBytes) {
fmt.Fprintf(os.Stderr, "assertion 3 failed: decoder modified invalid UTF-8 byte sequence\n")
os.Exit(1)
}
encOut, err := encoder.Bytes(invalidBytes)
if err != nil {
fmt.Fprintf(os.Stderr, "assertion 3 failed: encoder returned error on invalid UTF-8: %v\n", err)
os.Exit(1)
}
if !bytes.Equal(encOut, invalidBytes) {
fmt.Fprintf(os.Stderr, "assertion 3 failed: encoder modified invalid UTF-8 byte sequence\n")
os.Exit(1)
}
}
// Assertion 4: encoding.Nop.NewDecoder Reader wraps an io.Reader and reads the underlying byte stream unchanged
{
content := "Stream reader payload content with multi-line\nand special symbols."
rawReader := strings.NewReader(content)
wrappedReader := encoding.Nop.NewDecoder().Reader(rawReader)
readBytes, err := io.ReadAll(wrappedReader)
if err != nil {
fmt.Fprintf(os.Stderr, "assertion 4 failed: io.ReadAll returned error: %v\n", err)
os.Exit(1)
}
if string(readBytes) != content {
fmt.Fprintf(os.Stderr, "assertion 4 failed: wrapped Reader did not return exact source content\n")
os.Exit(1)
}
}
// Assertion 5: encoding.Nop.NewEncoder Writer wraps an io.Writer and writes the byte stream unchanged
{
content := []byte("Stream writer binary and text payload: \x00\x01\x02 testing 123")
var buf bytes.Buffer
wrappedWriter := encoding.Nop.NewEncoder().Writer(&buf)
n, err := wrappedWriter.Write(content)
if err != nil {
fmt.Fprintf(os.Stderr, "assertion 5 failed: Write returned error: %v\n", err)
os.Exit(1)
}
if n != len(content) {
fmt.Fprintf(os.Stderr, "assertion 5 failed: Write returned count %d, expected %d\n", n, len(content))
os.Exit(1)
}
if !bytes.Equal(buf.Bytes(), content) {
fmt.Fprintf(os.Stderr, "assertion 5 failed: wrapped Writer did not write exact source bytes\n")
os.Exit(1)
}
}
fmt.Println("All contract assertions passed successfully.")
}
Ursprungs-Seeder
anonym