Skip to content

goimports consistency: hook enforces gofmt only; 2 files carry goimports-style changes #352

Open

Description

@Amperstrand

From the #341 cold-review thread — follow-up as offered there.

Observation

The pre-commit hook (#343) enforces gofmt -l on staged files, but the repo currently contains goimports-style changes (import reordering/grouping) that gofmt neither produces nor checks. Concretely flagged in the #341 review: lightning.go, offline_wallet_integration_test.go, validator.go (the last fixed in #341's own review round). Meanwhile #341's cleanup PR itself introduced goimports-shaped diffs — meaning the repo's import style is drifting between "whatever the contributor's editor does" and "what gofmt allows".

Options

  1. Add a goimports check — extend the pre-commit hook and/or CI with goimports -l (needs goimports installed on contributor machines / a CI step). Strictest: repo becomes goimports-clean going forward.
  2. Document gofmt-only as the standard — explicitly state imports are hand-managed; goimports-shaped changes are unwelcome in "gofmt cleanup" PRs but not linted.
  3. One-shot normalize + CI pin — a single goimports-everything PR (like chore: gofmt cleanup — 16 files #341 but for imports), then enforce in CI only (not the local hook), avoiding the contributor-tooling requirement.

Option 3 is probably the sweet spot: local hooks stay dependency-free (consistent with #343's portability posture), CI does the enforcing, and the one-shot PR makes the baseline clean.

Happy to take whichever option is preferred — the one-shot normalize is mechanical.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions