@@ -18,19 +18,7 @@ Additional `AGENTS.md` files **may exist in subdirectories** to provide more con
1818
1919## 🔍 Project Overview
2020
21- ** go-subtree** is a production-ready scaffold for building new Go libraries with zero setup friction.
22- It ships with opinionated defaults that reflect current best practices—clean project layout,
23- module-aware dependency management, and Makefiles that automate everything from linting and race-condition
24- testing to snapshot releases. Out of the box, GitHub Actions orchestrate CI/CD: unit tests (with ` testify ` ),
25- coverage upload to Codecov, static analysis via golangci-lint and CodeQL, vulnerability auditing with Nancy,
26- and one-command releases through GoReleaser.
27-
28- Beyond automation, the template supplies all the "undifferentiated heavy lifting" a maintainer usually
29- adds manually: standard README and license, issue and PR templates, CODEOWNERS, semantic version tagging helpers,
30- label synchronization, and optional Slack/Discord/Twitter release announcements. Example functions, fuzz tests and
31- benchmarks are already wired in, so you can focus on writing library code instead of plumbing.
32- Clone, rename a few placeholders, and you have a fully instrumented Go library that is ready for continuous
33- delivery and open-source collaboration from day one.
21+ ** go-subtree** is a Go library for efficiently managing Bitcoin SV Subtree transaction structures.
3422
3523<br />
3624
@@ -106,11 +94,12 @@ Code must be cleanly formatted and pass all linters before being committed.
10694``` bash
10795go fmt ./...
10896goimports -w .
97+ gofumpt -w ./...
10998golangci-lint run
11099go vet ./...
111100```
112101
113- > Refer to ` .golangci.json ` for the full set of enabled linters.
102+ > Refer to ` .golangci.json ` for the full set of enabled linters and formatters .
114103
115104Editors should honor ` .editorconfig ` for indentation and whitespace rules, and
116105Git respects ` .gitattributes ` to enforce consistent line endings across
@@ -122,15 +111,17 @@ platforms.
122111
123112We use the ` testify ` suite for unit tests. All tests must follow these conventions:
124113
125- * Name tests using the pattern: ` TestFunctionName_ScenarioDescription `
114+ * Name tests using the pattern: ` TestFunctionNameScenarioDescription ` (no underscores) (PascalCase)
115+ * Use ` testify ` when possible, do not use ` testing ` directly
126116* Use ` testify/assert ` for general assertions
127117* Use ` testify/require ` for:
128- * All error or nil checks
129- * Any test where failure should halt execution
130- * Any test where a pointer or complex structure is required to be used after the check
118+ * All error or nil checks
119+ * Any test where failure should halt execution
120+ * Any test where a pointer or complex structure is required to be used after the check
131121* Use ` require.InDelta ` or ` require.InEpsilon ` for floating-point comparisons
132- * Prefer ** table-driven tests** for clarity and reusability
122+ * Prefer ** table-driven tests** for clarity and reusability, always have a name for each test case
133123* Use subtests (` t.Run ` ) to isolate and describe scenarios
124+ * If the test is in a test suite, always use the test suite instead of ` t ` directly
134125* ** Optionally use** ` t.Parallel() ` , but try and avoid it unless testing for concurrency issues
135126* Avoid flaky, timing-sensitive, or non-deterministic tests
136127
@@ -237,7 +228,7 @@ Great engineers write great comments. You're not here to state the obvious—you
237228* ** Your comments are part of the product**
238229
239230 > Treat them like UX copy. Make them clear, concise, and professional. You're writing for peers, not compilers.
240-
231+
241232<br /><br />
242233
243234### 🔤 Function Comments (Exported)
@@ -247,11 +238,11 @@ Every exported function **must** include a Go-style comment that:
247238* Starts with the function name
248239* States its purpose clearly
249240* Documents:
250- * ** Steps** : Include if the function performs a non-obvious sequence of operations.
251- * ** Parameters** : Always describe all parameters when present.
252- * ** Return values** : Document return types and their meaning if not trivially understood.
253- * ** Side effects** : Note any I/O, database writes, external calls, or mutations that aren't local to the function.
254- * ** Notes** : Include any assumptions, constraints, or important context that the caller should know.
241+ * **Steps**: Include if the function performs a non-obvious sequence of operations.
242+ * **Parameters**: Always describe all parameters when present.
243+ * **Return values**: Document return types and their meaning if not trivially understood.
244+ * **Side effects**: Note any I/O, database writes, external calls, or mutations that aren't local to the function.
245+ * **Notes**: Include any assumptions, constraints, or important context that the caller should know.
255246
256247Here is a template for function comments that is recommended to use:
257248
@@ -288,9 +279,9 @@ Here is a template for function comments that is recommended to use:
288279* Each package ** must** include a package-level comment in a file named after the package (e.g., ` auth.go ` for package ` auth ` ).
289280* If no logical file fits, add a ` doc.go ` with the comment block.
290281* Use it to explain:
291- * The package purpose
292- * High-level API boundaries
293- * Expected use-cases and design notes
282+ * The package purpose
283+ * High-level API boundaries
284+ * Expected use-cases and design notes
294285
295286Here is a template for package comments that is recommended to use:
296287
@@ -341,9 +332,9 @@ Use inline comments **strategically**, not excessively.
341332* Keep your tone ** precise, confident, and modern** —you're not writing a novel, but you're also not writing legacy COBOL.
342333* Avoid filler like "simple function" or "just does X".
343334* Don't leave TODOs unless:
344- * They are immediately actionable
345- * (or) they reference an issue
346- * They include a timestamp or owner
335+ * They are immediately actionable
336+ * (or) they reference an issue
337+ * They include a timestamp or owner
347338
348339<br /><br />
349340
@@ -569,7 +560,7 @@ We follow **Semantic Versioning (✧ SemVer)**:
569560### 📦 Tooling
570561
571562* Releases are driven by ** [ goreleaser] ** and configured in ` .goreleaser.yml ` .
572- * Install locally with Homebrew (Mac):
563+ * Install locally with Homebrew (Mac):
573564``` bash
574565 brew install goreleaser
575566````
@@ -581,9 +572,8 @@ We follow **Semantic Versioning (✧ SemVer)**:
581572| Step | Command | Purpose |
582573| ------| ---------------------------------| ----------------------------------------------------------------------------------------------------|
583574| 1 | ` make release-snap` | Build & upload a ** snapshot** (pre‑release) for quick CI validation. |
584- | 2 | ` make tag version=X.Y.Z` | Create and push a signed Git tag. Triggers GitHub Actions. |
575+ | 2 | ` make tag version=X.Y.Z` | Create and push a signed Git tag. Triggers GitHub Actions to package the release |
585576| 3 | GitHub Actions | CI runs ` goreleaser release` on the tag; artifacts and changelog are published to GitHub Releases. |
586- | 4 | ` make release` (optional local) | Manually invoke the production release if needed. |
587577
588578> ** Note for AI Agents:** Do not create or push tags automatically. Only the repository [codeowners](CODEOWNERS) are authorized to tag and publish official releases.
589579
@@ -644,7 +634,7 @@ Current labels are located in `.github/labels.yml` and automatically synced into
644634
645635CI automatically runs on every PR to verify:
646636
647- * Formatting (`go fmt` and `goimports`)
637+ * Formatting (`go fmt` and `goimports` and `gofumpt` )
648638* Linting (`golangci-lint run`)
649639* Tests (`go test ./...`)
650640* Fuzz tests (if applicable) (`make run-fuzz-tests`)
@@ -692,11 +682,17 @@ Dependency hygiene is critical for security, reproducibility, and developer expe
692682 govulncheck ./...
693683` ` `
694684
695- * Run via make command:
685+ * Run via make command:
696686` ` ` bash
697687 make govulncheck
698688` ` `
699689
690+ * Run [gitleaks](https://github.com/gitleaks/gitleaks) before committing code to detect hardcoded secrets or sensitive data in the repository:
691+ ` ` ` bash
692+ brew install gitleaks
693+ gitleaks detect --source . --log-opts=" --all" --verbose
694+ ` ` `
695+
700696* Address critical advisories before merging changes into ` master`
701697
702698* Document any intentionally ignored vulnerabilities with clear justification and issue tracking
@@ -726,9 +722,9 @@ Security is a first-class requirement. If you discover a vulnerability—no matt
726722* ** Do not** open a public issue or pull request.
727723* Follow the instructions in [` SECURITY.md` ](SECURITY.md).
728724* Include:
729- * A clear, reproducible description of the issue
730- * Proof‑of‑concept code or steps (if possible)
731- * Any known mitigations or workarounds
725+ * A clear, reproducible description of the issue
726+ * Proof‑of‑concept code or steps (if possible)
727+ * Any known mitigations or workarounds
732728* You will receive an acknowledgment within ** 72 hours** and status updates until the issue is resolved.
733729
734730> For general hardening guidance (e.g., ` govulncheck` , dependency pinning), see the [🔐Dependency Management](# -dependency-management) section.
@@ -741,7 +737,7 @@ Security is a first-class requirement. If you discover a vulnerability—no matt
741737
742738# # 🕓 Change Log (AGENTS.md)
743739
744- This section tracks notable updates to ` AGENTS.md` , including the date, author, and purpose of each revision.
740+ This section tracks notable updates to ` AGENTS.md` , including the date, author, and purpose of each revision.
745741All contributors are expected to append entries here when making meaningful changes to agent behavior, conventions, or policies.
746742
747743
0 commit comments