Skip to content

chore: gofmt cleanup — 16 files - #341

Closed
Amperstrand wants to merge 3 commits into
mainfrom
chore/gofmt-cleanup
Closed

Amperstrand wants to merge 3 commits into
mainfrom
chore/gofmt-cleanup

Conversation

@Amperstrand

Copy link
Copy Markdown
Collaborator

Pure formatting. gofmt -l . now returns empty on all source files.

Pure formatting fixes. No code changes. gofmt -l . now returns empty.
@Amperstrand

Copy link
Copy Markdown
Collaborator Author

Cold-review item (committed ELF binary): resolved. The 13MB unstripped scripts/token-recovery/token-recovery blob (7de4e476) had entered via an unrelated commit on this branch line, not the gofmt work itself. Branch rebuilt onto current main carrying only the gofmt cleanup (1e06f22) — binary absent from the diff, CI green. Note for the record: the blob was never in #340's tree; only this branch and #343's carried it.

@felixfelix-bot felixfelix-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cold review — new findings only (1 issue previously raised about ELF binary, resolved, not repeated).

1 major:

src/tollgate_protocol/validator.go:5-6 import reordering is wrong — github.com/nbd-wtf/go-nostr (third-party) is placed before strconv (stdlib) in the same import group without a blank-line separator. Neither gofmt nor goimports would produce this ordering. goimports would split stdlib and third-party into separate groups with a blank line.

3 minor:

  • 3 files have goimports-style changes (not gofmt) in a "gofmt cleanup" PR: lightning.go, offline_wallet_integration_test.go, validator.go
  • Inconsistency with #343's hook: if the pre-commit hook only enforces gofmt (not goimports), the import reordering may be flagged or inconsistent

Amperstrand pushed a commit to Amperstrand/tollgate-module-basic-go that referenced this pull request Aug 18, 2026
…only diff

- NUT-03 quote above TollWallet.Send gains the spec's final sentence
  ("These are then used by the wallet to generate new Proofs").
- The NUT-00 verification quote appeared verbatim above both
  Merchant.PurchaseSession and TollWallet.Receive; keeping the
  wallet-level one (verification is the mint-side swap check) and
  leaving a pointer at the merchant site — duplicate quotes against
  the same spec section flag in speccheck.
- Dropped the unrelated gofmt field-alignment change in main.go; the
  file now matches main byte-for-byte outside the quotes (main's
  existing gofmt dirt is OpenTollGate#341's scope).

Review findings: cold review 2026-08-18 (3 minors).
@Amperstrand

Copy link
Copy Markdown
Collaborator Author

Cold-review response — the import-ordering fix landed as 7b124b0 (yours — thank you, faster than my queued patch; local synced to it). On the goimports-vs-gofmt consistency minor: the remaining two files' changes are goimports-style import grouping, which the current hook doesn't enforce. Options: (a) leave as-is — non-blocking cosmetic; (b) extend #343's hook with a goimports check (needs goimports on contributor machines / CI). Suggest (a) for now with a follow-up issue if you want the repo goimports-clean; say the word and I'll file it.

@felixfelix-bot felixfelix-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed at 7b124b0: validator.go import grouping fixed. goimports consistency on the two cosmetic files — agreed, leave for a follow-up pass rather than churn this PR. Good to merge.

c03rad0r added a commit that referenced this pull request Aug 19, 2026
* chore: add NUT spec quotes (Layer 1 greatspectations adoption)

Adds verbatim NUT spec text as comments at key code locations:
- NUT #00: Token format prefix (cashu[version][token]) above extractCashuToken
- NUT #00: Verification flow above tollwallet.Receive
- NUT #5: Melt quote flow above tollwallet.Send

Adds specquotes.toml for greatspectations CI drift detection.
See: https://github.com/OpenTollGate/cashu-audit (Layer 1 framework)

* fix(#327): move NUT-05 quote to MeltToLightning, add NUT-03 above Send

felixfelix-bot feedback: NUT-05 (melt) quote was above Send(), but
Send() does a NUT-03 swap, not a melt. Moved NUT-05 quote above
MeltToLightning() which is the actual melt path. Added NUT-03
quote above Send() to match the swap operation.

* fix: verify all spec quotes pass greatspectations

- Fixed comment-start: '// ' (with space) per greatspectations requirement
- Fixed speccheck.sh: correct command name + glob expansion
- Fixed 6 quote texts to match NUT spec verbatim
- Added blank lines between quotes and docstrings
- Added 5 new NUT quotes across main.go, tollwallet.go, merchant.go

All 9 quotes verified: greatspectate check exit 0.

* fix: spec-quote polish — complete NUT-03 quote, dedupe NUT-00, scope-only diff

- NUT-03 quote above TollWallet.Send gains the spec's final sentence
  ("These are then used by the wallet to generate new Proofs").
- The NUT-00 verification quote appeared verbatim above both
  Merchant.PurchaseSession and TollWallet.Receive; keeping the
  wallet-level one (verification is the mint-side swap check) and
  leaving a pointer at the merchant site — duplicate quotes against
  the same spec section flag in speccheck.
- Dropped the unrelated gofmt field-alignment change in main.go; the
  file now matches main byte-for-byte outside the quotes (main's
  existing gofmt dirt is #341's scope).

Review findings: cold review 2026-08-18 (3 minors).

---------

Co-authored-by: Amperstrand <amperstrand@localhost>
Co-authored-by: amperstand <atlas@oh-my-opencode.com>
Co-authored-by: c03rad0r <1100745+c03rad0r@users.noreply.github.com>
@felixfelix-bot

Copy link
Copy Markdown
Contributor

Closing — rebased onto main as #355. Conflicts resolved, build verified.

@felixfelix-bot

Copy link
Copy Markdown
Contributor

SUPERSEDED by #355 — this branch was rebased onto main as rebase/pr-341 and a clean PR was opened at #355. Please close this PR.

@c03rad0r
c03rad0r self-requested a review August 20, 2026 12:31
Amperstrand pushed a commit to Amperstrand/tollgate-module-basic-go that referenced this pull request Aug 21, 2026
Surgical rebuild after the merge wave: OpenTollGate#312's squash already carried
this PR's vendor-IE content to main (encode/decode/scoring, staging
markers, tests — verified zero semantic delta in
vendor_element_manager.go, vendor_ie_encode_test.go, scanner.go).
The only content main still lacked is this schema fix: a Required
key with Default false rejected every existing config predating the
key; optional-with-default upgrades cleanly. Includes gofmt of the
file (converges with OpenTollGate#341's repo-wide pass).

Cold-review item from the OpenTollGate#332 round (minor 3).
c03rad0r added a commit that referenced this pull request Sep 13, 2026
)

* chore(format): make the tree gofmt- and goimports-clean (#352)

`gofmt -l src` printed three files on main, failing the pre-PR gate that
AGENTS.md and CONTRIBUTING.md already require, and two more carried the
goimports-shaped import grouping the #341 review flagged (#352):

- config_manager/config_schema.go: mis-indented VendorIEDiscovery literal
- merchant/lightning_state_test.go and merchant/quotes_wireformat_test.go:
  third-party imports out of sort order
- main.go: an extra blank-line group splitting the OpenTollGate imports
  from the remaining third-party ones
- merchant/merchant.go: "sync" stranded in its own group between the
  stdlib and third-party blocks

Whitespace and import order only; no behavior change. `gofmt -l src` and
`goimports -l src` now both print nothing, so the two tools agree on the
whole tree.

* docs(release): single-source the version and prepare v0.6.0-alpha2

Release paperwork for v0.6.0-alpha2. The tag and the publish stay behind
the operator gate; nothing here tags, publishes or announces.

Version single source of truth:
- `VERSION` at the repository root is now the one place the release
  version is written down. The three literals that disagreed are gone:
  `src/cli/version.go` (`v0.0.0`), `packaging/local-build-ipk.sh`
  (`v0.7.0-alpha10`) and `SETUP_VERSION="v0.6.2"` in
  `packaging/files/etc/uci-defaults/99-tollgate-setup`.
- CI refuses a tag that is not byte-identical to `VERSION`; the setup
  script ships a `__TOLLGATE_VERSION__` placeholder that the `.ipk`
  staging, the SDK `packaging/Makefile` and `local-build-ipk.sh`
  substitute (a copy run from a checkout falls back to the installed
  package version); `scripts/build-sdk-package.sh` derives from
  `VERSION`; `src/cli/version.go` keeps the non-release `dev` sentinel.
- New `scripts/check-version-sync.sh` enforces all of the above, plus
  that the CHANGELOG release heading and the `RELEASE-NOTES.md` title
  carry the version. `hooks/pre-commit` runs it when a
  version-carrying file is staged.

Documents:
- `CHANGELOG.md`: `[Unreleased]` becomes the `[v0.6.0-alpha2]` section
  (48 existing bullets, unchanged), a fresh `[Unreleased]` heading is
  left for the next cycle, two entries added for the version work, and
  the compare links updated.
- `RELEASE-NOTES.md` rewritten for v0.6.0-alpha2 — it was still the
  v0.5.0 document. Covers what's new, behavior changes worth flagging,
  notable fixes, security, internal/CI work, known issues (including
  the open `wallet drain cashu` funds-loss bug, #375), the verification
  status of each area, upgrade notes and artifact names.
- `docs/release-process.md`: maintainer runbook — pre-flight gates, the
  annotated-tag commands on upstream `main` (never the fork), the
  publish and verify sequence, and the traps that produced the orphaned
  `v0.7.0-alpha*` tags.
- `CONTRIBUTING.md` documents the version rules for contributors.

Verification: `gofmt -l .` from `src/` prints nothing (the tree was
already clean via #352); `go vet ./...`, `go build -buildvcs=false ./...`
and `go test -race -count=1 -tags testenv ./...` (root module, 15.5s)
pass; `sh scripts/check-version-sync.sh v0.6.0-alpha2` passes all 18
checks; the workflow YAML parses and the tag guards were exercised
locally (matching tag passes, `v0.6.0-rc-alpha1` and a bumped tag fail).

---------

Co-authored-by: Felix <301398501+felixfelix-bot@users.noreply.github.com>
Co-authored-by: c03rad0r <1100745+c03rad0r@users.noreply.github.com>
felixfelix-bot pushed a commit to felixfelix-bot/tollgate-module-basic-go that referenced this pull request Sep 20, 2026
* chore: add NUT spec quotes (Layer 1 greatspectations adoption)

Adds verbatim NUT spec text as comments at key code locations:
- NUT #00: Token format prefix (cashu[version][token]) above extractCashuToken
- NUT #00: Verification flow above tollwallet.Receive
- NUT #5: Melt quote flow above tollwallet.Send

Adds specquotes.toml for greatspectations CI drift detection.
See: https://github.com/OpenTollGate/cashu-audit (Layer 1 framework)

* fix(OpenTollGate#327): move NUT-05 quote to MeltToLightning, add NUT-03 above Send

felixfelix-bot feedback: NUT-05 (melt) quote was above Send(), but
Send() does a NUT-03 swap, not a melt. Moved NUT-05 quote above
MeltToLightning() which is the actual melt path. Added NUT-03
quote above Send() to match the swap operation.

* fix: verify all spec quotes pass greatspectations

- Fixed comment-start: '// ' (with space) per greatspectations requirement
- Fixed speccheck.sh: correct command name + glob expansion
- Fixed 6 quote texts to match NUT spec verbatim
- Added blank lines between quotes and docstrings
- Added 5 new NUT quotes across main.go, tollwallet.go, merchant.go

All 9 quotes verified: greatspectate check exit 0.

* fix: spec-quote polish — complete NUT-03 quote, dedupe NUT-00, scope-only diff

- NUT-03 quote above TollWallet.Send gains the spec's final sentence
  ("These are then used by the wallet to generate new Proofs").
- The NUT-00 verification quote appeared verbatim above both
  Merchant.PurchaseSession and TollWallet.Receive; keeping the
  wallet-level one (verification is the mint-side swap check) and
  leaving a pointer at the merchant site — duplicate quotes against
  the same spec section flag in speccheck.
- Dropped the unrelated gofmt field-alignment change in main.go; the
  file now matches main byte-for-byte outside the quotes (main's
  existing gofmt dirt is OpenTollGate#341's scope).

Review findings: cold review 2026-08-18 (3 minors).

---------

Co-authored-by: Amperstrand <amperstrand@localhost>
Co-authored-by: amperstand <atlas@oh-my-opencode.com>
Co-authored-by: c03rad0r <1100745+c03rad0r@users.noreply.github.com>
felixfelix-bot added a commit to felixfelix-bot/tollgate-module-basic-go that referenced this pull request Sep 20, 2026
…penTollGate#380)

* chore(format): make the tree gofmt- and goimports-clean (OpenTollGate#352)

`gofmt -l src` printed three files on main, failing the pre-PR gate that
AGENTS.md and CONTRIBUTING.md already require, and two more carried the
goimports-shaped import grouping the OpenTollGate#341 review flagged (OpenTollGate#352):

- config_manager/config_schema.go: mis-indented VendorIEDiscovery literal
- merchant/lightning_state_test.go and merchant/quotes_wireformat_test.go:
  third-party imports out of sort order
- main.go: an extra blank-line group splitting the OpenTollGate imports
  from the remaining third-party ones
- merchant/merchant.go: "sync" stranded in its own group between the
  stdlib and third-party blocks

Whitespace and import order only; no behavior change. `gofmt -l src` and
`goimports -l src` now both print nothing, so the two tools agree on the
whole tree.

* docs(release): single-source the version and prepare v0.6.0-alpha2

Release paperwork for v0.6.0-alpha2. The tag and the publish stay behind
the operator gate; nothing here tags, publishes or announces.

Version single source of truth:
- `VERSION` at the repository root is now the one place the release
  version is written down. The three literals that disagreed are gone:
  `src/cli/version.go` (`v0.0.0`), `packaging/local-build-ipk.sh`
  (`v0.7.0-alpha10`) and `SETUP_VERSION="v0.6.2"` in
  `packaging/files/etc/uci-defaults/99-tollgate-setup`.
- CI refuses a tag that is not byte-identical to `VERSION`; the setup
  script ships a `__TOLLGATE_VERSION__` placeholder that the `.ipk`
  staging, the SDK `packaging/Makefile` and `local-build-ipk.sh`
  substitute (a copy run from a checkout falls back to the installed
  package version); `scripts/build-sdk-package.sh` derives from
  `VERSION`; `src/cli/version.go` keeps the non-release `dev` sentinel.
- New `scripts/check-version-sync.sh` enforces all of the above, plus
  that the CHANGELOG release heading and the `RELEASE-NOTES.md` title
  carry the version. `hooks/pre-commit` runs it when a
  version-carrying file is staged.

Documents:
- `CHANGELOG.md`: `[Unreleased]` becomes the `[v0.6.0-alpha2]` section
  (48 existing bullets, unchanged), a fresh `[Unreleased]` heading is
  left for the next cycle, two entries added for the version work, and
  the compare links updated.
- `RELEASE-NOTES.md` rewritten for v0.6.0-alpha2 — it was still the
  v0.5.0 document. Covers what's new, behavior changes worth flagging,
  notable fixes, security, internal/CI work, known issues (including
  the open `wallet drain cashu` funds-loss bug, OpenTollGate#375), the verification
  status of each area, upgrade notes and artifact names.
- `docs/release-process.md`: maintainer runbook — pre-flight gates, the
  annotated-tag commands on upstream `main` (never the fork), the
  publish and verify sequence, and the traps that produced the orphaned
  `v0.7.0-alpha*` tags.
- `CONTRIBUTING.md` documents the version rules for contributors.

Verification: `gofmt -l .` from `src/` prints nothing (the tree was
already clean via OpenTollGate#352); `go vet ./...`, `go build -buildvcs=false ./...`
and `go test -race -count=1 -tags testenv ./...` (root module, 15.5s)
pass; `sh scripts/check-version-sync.sh v0.6.0-alpha2` passes all 18
checks; the workflow YAML parses and the tag guards were exercised
locally (matching tag passes, `v0.6.0-rc-alpha1` and a bumped tag fail).

---------

Co-authored-by: Felix <301398501+felixfelix-bot@users.noreply.github.com>
Co-authored-by: c03rad0r <1100745+c03rad0r@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants