{"id":22312103,"url":"https://github.com/tam7t/cautious-pancake","last_synced_at":"2025-07-29T09:32:21.836Z","repository":{"id":11449774,"uuid":"69717743","full_name":"tam7t/cautious-pancake","owner":"tam7t","description":"identity pure functions in golang source","archived":false,"fork":false,"pushed_at":"2023-03-18T14:15:26.000Z","size":60,"stargazers_count":25,"open_issues_count":2,"forks_count":2,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-06-20T17:52:41.095Z","etag":null,"topics":["code-generator","fuzz","golang-tools"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tam7t.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-01T03:41:07.000Z","updated_at":"2023-09-16T01:33:42.000Z","dependencies_parsed_at":"2024-06-20T17:42:41.042Z","dependency_job_id":null,"html_url":"https://github.com/tam7t/cautious-pancake","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tam7t%2Fcautious-pancake","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tam7t%2Fcautious-pancake/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tam7t%2Fcautious-pancake/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tam7t%2Fcautious-pancake/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tam7t","download_url":"https://codeload.github.com/tam7t/cautious-pancake/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228004683,"owners_count":17854871,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code-generator","fuzz","golang-tools"],"created_at":"2024-12-03T21:34:02.487Z","updated_at":"2024-12-03T21:34:03.009Z","avatar_url":"https://github.com/tam7t.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cautious-pancake\n\n[![GoDoc](https://godoc.org/github.com/tam7t/cautious-pancake?status.svg)](https://pkg.go.dev/github.com/tam7t/cautious-pancake) [![Go Report Card](https://goreportcard.com/badge/github.com/tam7t/cautious-pancake)](https://goreportcard.com/report/github.com/tam7t/cautious-pancake)\n\ngithub generated the repo name for me\n\n## fuzzing\n\n`cautious-pancake` aims to make fuzzing golang packages easier by identifying\n[pure functions](https://en.wikipedia.org/wiki/Pure_function). These functions\ncan be easily fuzzed since they only operate on their direct inputs and do not\nmodify global state.\n\n## example\n\n### `pancakeinfo`\n\nGiven a package, `pancakeinfo` will tell you which functions are pure:\n\n```shell\n$ go get -u github.com/tam7t/cautious-pancake/cmd/pancakeinfo\n$ pancakeinfo -pkg=github.com/mdlayher/arp\n(Operation).String\nNewPacket\n(Client).HardwareAddr\n(*Packet).UnmarshalBinary\n(*Packet).MarshalBinary\n```\n\nThe `-pure=false` flag will return all functions deemed impure, including\nthe reason for the determination and the `-private` flag will display\ninformation on private functions as well.\n\n### `pancakegen`\n\nGiven a package and a function, `pancakegen` will generate code to fuzz that\nfunction:\n\n```text\n$ go get -u github.com/tam7t/cautious-pancake/cmd/pancakegen\n$ pancakegen -pkg=github.com/tam7t/cautious-pancake/fixtures -func=YesMaybePanic\npackage fixtures\n\nimport (\n\t\"testing\"\n)\n\nfunc FuzzYesMaybePanic(f *testing.F) {\n\tf.Fuzz(func(t *testing.T, p0 byte) { \n\t\tYesMaybePanic(p0)\n\t})\n}\n```\n\nIf you run the generated code you will quickly get:\n\n```shell\n$ go test ./fixtures/... --fuzz=Fuzz\nfuzz: elapsed: 0s, gathering baseline coverage: 0/1 completed\nfuzz: elapsed: 0s, gathering baseline coverage: 1/1 completed, now fuzzing with 16 workers\nfuzz: elapsed: 0s, execs: 20 (701/sec), new interesting: 0 (total: 1)\n--- FAIL: FuzzYesMaybePanic (0.03s)\n    --- FAIL: FuzzYesMaybePanic (0.00s)\n        testing.go:1349: panic: bad input\n            goroutine 35 [running]:\n            runtime/debug.Stack()\n                /usr/local/go/src/runtime/debug/stack.go:24 +0x90\n            testing.tRunner.func1()\n                /usr/local/go/src/testing/testing.go:1349 +0x1f2\n            panic({0x65dd40, 0x6ee3e0})\n                /usr/local/go/src/runtime/panic.go:838 +0x207\n            github.com/tam7t/cautious-pancake/fixtures.YesMaybePanic(...)\n                /home/tam7t/code/github.com/tam7t/cautious-pancake/fixtures/fuzzable.go:97\n            github.com/tam7t/cautious-pancake/fixtures.FuzzYesMaybePanic.func1(0x0?, 0xa)\n                /home/tam7t/code/github.com/tam7t/cautious-pancake/fixtures/fuzzable_test.go:9 +0x77\n            reflect.Value.call({0x660400?, 0x6b5f98?, 0x13?}, {0x69f589, 0x4}, {0xc00009bc80, 0x2, 0x2?})\n                /usr/local/go/src/reflect/value.go:556 +0x845\n            reflect.Value.Call({0x660400?, 0x6b5f98?, 0x514?}, {0xc00009bc80, 0x2, 0x2})\n                /usr/local/go/src/reflect/value.go:339 +0xbf\n            testing.(*F).Fuzz.func1.1(0x0?)\n                /usr/local/go/src/testing/fuzz.go:337 +0x231\n            testing.tRunner(0xc0001a16c0, 0xc00018aea0)\n                /usr/local/go/src/testing/testing.go:1439 +0x102\n            created by testing.(*F).Fuzz.func1\n                /usr/local/go/src/testing/fuzz.go:324 +0x5b8\n            \n    \n    Failing input written to testdata/fuzz/FuzzYesMaybePanic/358fa4d16da00de4d29482b2ea74da673eb27bfc5614d2b123ac0aa89e0e1ea5\n    To re-run:\n    go test -run=FuzzYesMaybePanic/358fa4d16da00de4d29482b2ea74da673eb27bfc5614d2b123ac0aa89e0e1ea5\nFAIL\nexit status 1\nFAIL    github.com/tam7t/cautious-pancake/fixtures      0.032s\n```\n\nindicating that `fixtures.YesMaybePanic(0xA)` will result in a panic.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftam7t%2Fcautious-pancake","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftam7t%2Fcautious-pancake","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftam7t%2Fcautious-pancake/lists"}