Skip to content

review: full-repo style audit — godoc and declaration-layout normalization#93

Merged
CMGS merged 2 commits into
masterfrom
review/code-audit
Jul 6, 2026
Merged

review: full-repo style audit — godoc and declaration-layout normalization#93
CMGS merged 2 commits into
masterfrom
review/code-audit

Conversation

@CMGS

@CMGS CMGS commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Follow-up to the updated code standard: a full audit of all 244 non-vendor Go files, applied as two layout/comment-only commits with zero behavior change.

Commit 1 — godoc

+15 lines, comments only. Adds godoc to exported types, New constructors, and methods whose documented siblings made the omission an inconsistency (e.g. Ops.List between documented Inspect/Delete, DirectRestore next to documented DirectClone). Deliberately NOT covered: interface-implementing methods (the interface documents the contract), consistent accessor/skip-all files, and build-tag stub twins.

Commit 2 — declaration layout

Pure moves and comment deletions (verified per file: sorted line multiset unchanged):

  • metering: compile-time interface checks moved from a shared top var block to standalone assertions immediately above their implementing types (Entry, NopRecorder)
  • cloudhypervisor/utils: chMemoryRestoreMode moved below const/var (imports → const → var → types; const referencing a later-declared type matches the types/vm.go precedent)
  • oci/cloudimg image: imageIndex and imageEntry each kept adjacent to their own method set; leaf types trail
  • types/vm: VMConfig.Validate moved next to VMConfig (was split off by the whole VM block)
  • cloudhypervisor/clone_test: dropped bare function-name section labels

Deliberately unchanged

  • extend/fs·vfio·netresize + utils/process_linux: consistent existing design (Spec leads → vocabulary types → methods); reshuffling adds churn without clarity
  • Two flagged nil-derefs rejected as false positives after tracing: FinalizeClone callers all pass &types.VM{...} literals and GetRecord nil-checks; ToVM is reached only via ResolveRef (every branch requires a non-nil record) or MapValues (skips nil entries)

Verification

  • Build linux+darwin ok; lint 0 issues on both GOOS; full test suite 25 packages green (with -race)
  • Pure-move proof: sorted non-blank line sets identical pre/post for 4/6 files; the other two differ exactly by the intended var-block split and the 4 deleted label comments

CMGS added 2 commits July 6, 2026 18:10
…hod siblings

From a full-repo /code audit against the updated SKILL.md. Only exported
types, New constructors, and methods whose documented siblings make the
omission an inconsistency are covered; interface-implementing methods,
consistent accessor/skip-all files, and build-tag stubs are left as-is.
Full-repo /code audit follow-up; layout-only, zero behavior change:
- metering: place compile-time interface checks above their implementing
  types (Entry, NopRecorder) instead of a shared top-of-file var block
- cloudhypervisor/utils: move chMemoryRestoreMode below const/var
  (imports -> const -> var -> types)
- oci/cloudimg image: keep imageIndex and imageEntry each adjacent to
  their own method set; leaf/vocabulary types trail
- types/vm: move VMConfig.Validate next to VMConfig (was split off by the
  whole VM type in between)
- cloudhypervisor/clone_test: drop bare function-name section labels
@CMGS CMGS merged commit d0252ce into master Jul 6, 2026
4 checks passed
@CMGS CMGS deleted the review/code-audit branch July 6, 2026 10:32
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.

1 participant