Sample
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572: FuncMap, TxtFuncMap, HtmlFuncMap
Verified sample for golang github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572: FuncMap, TxtFuncMap, HtmlFuncMap. The contract ran on go 1.26 …
sha256:e6ed7a878958870a378a3482cae76d37ad5df574f3c370ed505c9ee8783affe0
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
- 2
- Signing keys that built it
- 1
Declared environment
go 1.26 linux 24 · ubuntu · glibc 2.39 x64 go 1.26 go go 1
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| go 1.26 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · golang@1golang:1.26-alpine@sha256:28d89ee9cc0f… |
2026-08-23 |
| 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-07 |
Case
HOW- Goal
- verify pkg:golang/github.com/go-task/slim-sprig@v0.0.0-20230315185526-52ccab3ef572
- Symbols
-
- github.com/go-task/slim-sprig.FuncMap
- github.com/go-task/slim-sprig.TxtFuncMap
- github.com/go-task/slim-sprig.HtmlFuncMap
- github.com/go-task/slim-sprig.GenericFuncMap
- github.com/go-task/slim-sprig.HermeticTxtFuncMap
- github.com/go-task/slim-sprig.HermeticHtmlFuncMap
- Environment
- go 1.26.6
- Created
- 2026-08-23T17:27:31Z
Contract
- sprig.FuncMap produces template.FuncMap containing string, math, collection, and serialization helper functions
- sprig.TxtFuncMap and sprig.HtmlFuncMap produce helper maps for text/template and html/template
- sprig.GenericFuncMap returns map of sprig helper functions without html/template or text/template dependencies
- sprig.HermeticTxtFuncMap and sprig.HermeticHtmlFuncMap provide deterministic helper maps excluding environment and clock functions
- template execution uses sprig helper functions for string trimming, uppercase conversion, defaults, lists, dicts, and base64 encoding
Files
- PROMPT.md
- csx.json
- go.mod
- go.sum
- 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 pkg:golang/github.com/go-task/slim-sprig@v0.0.0-20230315185526-52ccab3ef572
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/github.com/go-task/slim-sprig@v0.0.0-20230315185526-52ccab3ef572
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- packageManager: npm@10.9.8
- runtime: node@22.23.2
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:2103b1715034cde2072c2517e2ac980babc8221915c6022621e1643f98ebbba2","contract":["sprig.FuncMap produces template.FuncMap containing string, math, collection, and serialization helper functions","sprig.TxtFuncMap and sprig.HtmlFuncMap produce helper maps for text/template and html/template","sprig.GenericFuncMap returns map of sprig helper functions without html/template or text/template dependencies","sprig.HermeticTxtFuncMap and sprig.HermeticHtmlFuncMap provide deterministic helper maps excluding environment and clock functions","template execution uses sprig helper functions for string trimming, uppercase conversion, defaults, lists, dicts, and base64 encoding"],"goal":"verify pkg:golang/github.com/go-task/slim-sprig@v0.0.0-20230315185526-52ccab3ef572","kind":"HOW","packages":["pkg:golang/github.com/go-task/slim-sprig@v0.0.0-20230315185526-52ccab3ef572"],"schemaVersion":1,"symbols":["github.com/go-task/slim-sprig.FuncMap","github.com/go-task/slim-sprig.TxtFuncMap","github.com/go-task/slim-sprig.HtmlFuncMap","github.com/go-task/slim-sprig.GenericFuncMap","github.com/go-task/slim-sprig.HermeticTxtFuncMap","github.com/go-task/slim-sprig.HermeticHtmlFuncMap"]},"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/github.com/go-task/slim-sprig@v0.0.0-20230315185526-52ccab3ef572"],"schemaVersion":1,"subject":"pkg:golang/github.com/go-task/slim-sprig@v0.0.0-20230315185526-52ccab3ef572","symbols":["github.com/go-task/slim-sprig.FuncMap","github.com/go-task/slim-sprig.TxtFuncMap","github.com/go-task/slim-sprig.HtmlFuncMap","github.com/go-task/slim-sprig.GenericFuncMap","github.com/go-task/slim-sprig.HermeticTxtFuncMap","github.com/go-task/slim-sprig.HermeticHtmlFuncMap"],"verifierAdapter":"golang@1"}
module sample
go 1.26.6
require github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
{
"schemaVersion": 1,
"goal": "verify pkg:golang/github.com/go-task/slim-sprig@v0.0.0-20230315185526-52ccab3ef572",
"kind": "HOW",
"packages": [
"pkg:golang/github.com/go-task/slim-sprig@v0.0.0-20230315185526-52ccab3ef572"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
package main
import (
"bytes"
"fmt"
htemplate "html/template"
"os"
"strings"
ttemplate "text/template"
sprig "github.com/go-task/slim-sprig"
)
func main() {
if err := runTests(); err != nil {
fmt.Fprintf(os.Stderr, "Contract test failed: %v\n", err)
os.Exit(1)
}
fmt.Println("All contract tests passed successfully.")
}
func runTests() error {
// 1. Test sprig.FuncMap returns template.FuncMap containing core helper functions
fm := sprig.FuncMap()
if fm == nil || len(fm) == 0 {
return fmt.Errorf("sprig.FuncMap() returned empty or nil map")
}
requiredKeys := []string{
"trim", "upper", "lower", "default", "list", "dict",
"join", "split", "toJson", "fromJson", "add", "mul",
"coalesce", "hasKey", "keys", "values", "b64enc", "b64dec", "sha256sum",
}
for _, key := range requiredKeys {
if _, ok := fm[key]; !ok {
return fmt.Errorf("sprig.FuncMap missing required key %q", key)
}
}
// 2. Test sprig.TxtFuncMap and sprig.HtmlFuncMap provide template helper maps
txtFm := sprig.TxtFuncMap()
if txtFm == nil || len(txtFm) == 0 {
return fmt.Errorf("sprig.TxtFuncMap() returned empty or nil map")
}
htmlFm := sprig.HtmlFuncMap()
if htmlFm == nil || len(htmlFm) == 0 {
return fmt.Errorf("sprig.HtmlFuncMap() returned empty or nil map")
}
// 3. Test sprig.GenericFuncMap returns map of sprig helper functions without template dependencies
gfm := sprig.GenericFuncMap()
if gfm == nil || len(gfm) == 0 {
return fmt.Errorf("sprig.GenericFuncMap() returned empty or nil map")
}
for _, key := range requiredKeys {
if _, ok := gfm[key]; !ok {
return fmt.Errorf("sprig.GenericFuncMap missing required key %q", key)
}
}
// 4. Test sprig.HermeticTxtFuncMap and sprig.HermeticHtmlFuncMap provide deterministic helper maps
hermeticTxt := sprig.HermeticTxtFuncMap()
if hermeticTxt == nil || len(hermeticTxt) == 0 {
return fmt.Errorf("sprig.HermeticTxtFuncMap() returned empty or nil map")
}
hermeticHtml := sprig.HermeticHtmlFuncMap()
if hermeticHtml == nil || len(hermeticHtml) == 0 {
return fmt.Errorf("sprig.HermeticHtmlFuncMap() returned empty or nil map")
}
if _, ok := hermeticTxt["env"]; ok {
return fmt.Errorf("sprig.HermeticTxtFuncMap should not contain 'env'")
}
if _, ok := hermeticTxt["expandenv"]; ok {
return fmt.Errorf("sprig.HermeticTxtFuncMap should not contain 'expandenv'")
}
// 5. Test text/template execution using sprig helper functions
tmplText := `{{ " hello world " | trim | upper }}|{{ "" | default "fallback" }}|{{ list "a" "b" "c" | join "-" }}|{{ add 10 5 }}|{{ mul 4 3 }}|{{ "hello" | b64enc }}|{{ "aGVsbG8=" | b64dec }}|{{ "test" | sha256sum }}`
tmpl, err := ttemplate.New("test").Funcs(fm).Parse(tmplText)
if err != nil {
return fmt.Errorf("text/template parse failed: %w", err)
}
var buf bytes.Buffer
if err := tmpl.Execute(&buf, nil); err != nil {
return fmt.Errorf("text/template execute failed: %w", err)
}
expectedParts := []string{
"HELLO WORLD",
"fallback",
"a-b-c",
"15",
"12",
"aGVsbG8=",
"hello",
"9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
}
gotOutput := buf.String()
expectedOutput := strings.Join(expectedParts, "|")
if gotOutput != expectedOutput {
return fmt.Errorf("template output mismatch:\n got: %q\n want: %q", gotOutput, expectedOutput)
}
// 6. Test dict, keys, hasKey, and JSON serialization in template
dictTmplText := `{{ $d := dict "name" "sample" "count" 42 }}{{ hasKey $d "name" }}|{{ get $d "count" }}|{{ $d | toJson }}`
dictTmpl, err := ttemplate.New("dictTest").Funcs(fm).Parse(dictTmplText)
if err != nil {
return fmt.Errorf("dict template parse failed: %w", err)
}
var dictBuf bytes.Buffer
if err := dictTmpl.Execute(&dictBuf, nil); err != nil {
return fmt.Errorf("dict template execute failed: %w", err)
}
dictOutput := dictBuf.String()
if !strings.HasPrefix(dictOutput, "true|42|") {
return fmt.Errorf("dict template output unexpected: %q", dictOutput)
}
// 7. Test html/template execution with HtmlFuncMap
htmlTmplText := `<b>{{ .Name | upper | html }}</b>`
htmlTmpl, err := htemplate.New("htmlTest").Funcs(htmlFm).Parse(htmlTmplText)
if err != nil {
return fmt.Errorf("html/template parse failed: %w", err)
}
var htmlBuf bytes.Buffer
if err := htmlTmpl.Execute(&htmlBuf, map[string]string{"Name": "<safe & sound>"}); err != nil {
return fmt.Errorf("html/template execute failed: %w", err)
}
expectedHTML := `<b><SAFE & SOUND></b>`
if htmlBuf.String() != expectedHTML {
return fmt.Errorf("html/template output mismatch: got %q, want %q", htmlBuf.String(), expectedHTML)
}
// 8. Test direct generic function execution from GenericFuncMap
upperFn, ok := gfm["upper"].(func(string) string)
if !ok {
return fmt.Errorf("gfm['upper'] is not func(string) string (got %T)", gfm["upper"])
}
if got := upperFn("sprig"); got != "SPRIG" {
return fmt.Errorf("gfm['upper']('sprig') = %q, want 'SPRIG'", got)
}
b64encFn, ok := gfm["b64enc"].(func(string) string)
if !ok {
return fmt.Errorf("gfm['b64enc'] is not func(string) string (got %T)", gfm["b64enc"])
}
if got := b64encFn("data"); got != "ZGF0YQ==" {
return fmt.Errorf("gfm['b64enc']('data') = %q, want 'ZGF0YQ=='", got)
}
return nil
}
Origin Seeder
anonymous