Sample
github.com/libdns/libdns v1.1.1: RelativeName
Verified sample for golang github.com/libdns/libdns v1.1.1: RelativeName. The contract ran on go 1.26 · linux debian/x64 · docker and passed.
sha256:96d67818f9db591c0bbb1ce67bb081ad44ed77ad41bfe5fe238f010cde3f61a0
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 1
- Signing keys that built it
- 1
Declared environment
go 1.26 linux 24 · ubuntu · glibc 2.39 x64 go 1.26 go 1.26 go 1
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| 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-09-06 |
Case
HOW- Goal
- verify github.com/libdns/libdns.RelativeName in pkg:golang/github.com/libdns/libdns@v1.1.1
- Packages
- Symbols
-
- github.com/libdns/libdns.RelativeName
- Environment
- go 1.26.6
- Created
- 2026-09-06T11:43:53Z
Contract
- RelativeName strips the zone suffix from a fully-qualified domain name to return the relative subdomain
- RelativeName returns @ when the domain name matches the zone name
- RelativeName ignores trailing dots on both fqdn and zone
- RelativeName returns the fqdn without trailing dot when the domain is outside the zone
- RelativeName returns stripped fqdn or empty string when zone is empty or input is empty
Files
- PROMPT.md
- csx.json
- go.mod
- go.sum
- main.go
- spec.json
- test/contract.go
Source
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/libdns/libdns.RelativeName in pkg:golang/github.com/libdns/libdns@v1.1.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/github.com/libdns/libdns@v1.1.1
Demonstrate these symbols/APIs:
- github.com/libdns/libdns.RelativeName
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:ce670262f34284cb6d8cced9b48bd8f34bf6d7351a1c87bb49c4a08fc7db3840","contract":["RelativeName strips the zone suffix from a fully-qualified domain name to return the relative subdomain","RelativeName returns @ when the domain name matches the zone name","RelativeName ignores trailing dots on both fqdn and zone","RelativeName returns the fqdn without trailing dot when the domain is outside the zone","RelativeName returns stripped fqdn or empty string when zone is empty or input is empty"],"goal":"verify github.com/libdns/libdns.RelativeName in pkg:golang/github.com/libdns/libdns@v1.1.1","kind":"HOW","packages":["pkg:golang/github.com/libdns/libdns@v1.1.1"],"schemaVersion":1,"symbols":["github.com/libdns/libdns.RelativeName"]},"contractCommand":["go","run","./test"],"environment":{"arch":"x64","compiler":"go","compilerVersion":"1.26.6","distro":"ubuntu","ecosystem":"golang","language":"go","languageVersion":"1.26.6","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/github.com/libdns/libdns@v1.1.1"],"schemaVersion":1,"subject":"pkg:golang/github.com/libdns/libdns@v1.1.1","symbols":["github.com/libdns/libdns.RelativeName"],"verifierAdapter":"golang@1"}
module sample
go 1.26.6
require github.com/libdns/libdns v1.1.1
github.com/libdns/libdns v1.1.1 h1:wPrHrXILoSHKWJKGd0EiAVmiJbFShguILTg9leS/P/U=
github.com/libdns/libdns v1.1.1/go.mod h1:4Bj9+5CQiNMVGf87wjX4CY3HQJypUHRuLvlsfsZqLWQ=
package main
import (
"fmt"
"github.com/libdns/libdns"
)
func main() {
zone := "example.com."
// RelativeName strips the zone to return relative record names
sub := libdns.RelativeName("sub.example.com.", zone)
fmt.Printf("Relative name for 'sub.example.com.': %s\n", sub)
// FQDN matching zone returns "@"
apex := libdns.RelativeName("example.com.", zone)
fmt.Printf("Apex record name: %s\n", apex)
// Outside zone returns the name without trailing dot
other := libdns.RelativeName("api.otherdomain.com.", zone)
fmt.Printf("Outside zone: %s\n", other)
}
{
"schemaVersion": 1,
"goal": "verify github.com/libdns/libdns.RelativeName in pkg:golang/github.com/libdns/libdns@v1.1.1",
"kind": "HOW",
"packages": [
"pkg:golang/github.com/libdns/libdns@v1.1.1"
],
"symbols": [
"github.com/libdns/libdns.RelativeName"
]
}
package main
import (
"fmt"
"os"
"github.com/libdns/libdns"
)
func main() {
// Assertion 1: RelativeName strips the zone suffix from a fully-qualified domain name to return the relative subdomain
{
got := libdns.RelativeName("sub.example.com.", "example.com.")
want := "sub"
if got != want {
fmt.Fprintf(os.Stderr, "assertion 1 failed: got %q, want %q\n", got, want)
os.Exit(1)
}
gotMulti := libdns.RelativeName("foo.bar.example.com.", "example.com.")
wantMulti := "foo.bar"
if gotMulti != wantMulti {
fmt.Fprintf(os.Stderr, "assertion 1 failed for multi-label: got %q, want %q\n", gotMulti, wantMulti)
os.Exit(1)
}
gotNested := libdns.RelativeName("foo.bar.example.com", "bar.example.com")
wantNested := "foo"
if gotNested != wantNested {
fmt.Fprintf(os.Stderr, "assertion 1 failed for nested subzone: got %q, want %q\n", gotNested, wantNested)
os.Exit(1)
}
}
// Assertion 2: RelativeName returns @ when the domain name matches the zone name
{
gotWithDots := libdns.RelativeName("example.com.", "example.com.")
want := "@"
if gotWithDots != want {
fmt.Fprintf(os.Stderr, "assertion 2 failed with dots: got %q, want %q\n", gotWithDots, want)
os.Exit(1)
}
gotWithoutDots := libdns.RelativeName("example.com", "example.com")
if gotWithoutDots != want {
fmt.Fprintf(os.Stderr, "assertion 2 failed without dots: got %q, want %q\n", gotWithoutDots, want)
os.Exit(1)
}
gotMixed := libdns.RelativeName("example.com.", "example.com")
if gotMixed != want {
fmt.Fprintf(os.Stderr, "assertion 2 failed mixed: got %q, want %q\n", gotMixed, want)
os.Exit(1)
}
}
// Assertion 3: RelativeName ignores trailing dots on both fqdn and zone
{
got1 := libdns.RelativeName("sub.example.com", "example.com")
got2 := libdns.RelativeName("sub.example.com.", "example.com")
got3 := libdns.RelativeName("sub.example.com", "example.com.")
got4 := libdns.RelativeName("sub.example.com.", "example.com.")
want := "sub"
if got1 != want || got2 != want || got3 != want || got4 != want {
fmt.Fprintf(os.Stderr, "assertion 3 failed: got [%q, %q, %q, %q], want all %q\n", got1, got2, got3, got4, want)
os.Exit(1)
}
}
// Assertion 4: RelativeName returns the fqdn without trailing dot when the domain is outside the zone
{
gotDiffDomain := libdns.RelativeName("example.com", "example.net")
wantDiff := "example.com"
if gotDiffDomain != wantDiff {
fmt.Fprintf(os.Stderr, "assertion 4 failed for different domain: got %q, want %q\n", gotDiffDomain, wantDiff)
os.Exit(1)
}
gotOther := libdns.RelativeName("sub.other.org.", "example.com.")
wantOther := "sub.other.org"
if gotOther != wantOther {
fmt.Fprintf(os.Stderr, "assertion 4 failed for other fqdn: got %q, want %q\n", gotOther, wantOther)
os.Exit(1)
}
}
// Assertion 5: RelativeName returns stripped fqdn or empty string when zone is empty or input is empty
{
gotBothEmpty := libdns.RelativeName("", "")
if gotBothEmpty != "" {
fmt.Fprintf(os.Stderr, "assertion 5 failed for both empty: got %q, want empty\n", gotBothEmpty)
os.Exit(1)
}
gotEmptyFQDN := libdns.RelativeName("", "example.com.")
if gotEmptyFQDN != "" {
fmt.Fprintf(os.Stderr, "assertion 5 failed for empty FQDN: got %q, want empty\n", gotEmptyFQDN)
os.Exit(1)
}
gotEmptyZone := libdns.RelativeName("example.com.", "")
if gotEmptyZone != "example.com" {
fmt.Fprintf(os.Stderr, "assertion 5 failed for empty zone: got %q, want %q\n", gotEmptyZone, "example.com")
os.Exit(1)
}
}
fmt.Println("All contract assertions passed successfully.")
}
Origin Seeder
anonymous