Source: Full code review 2026-07-17 (docs/reviews/2026-07-17-full-code-review.md), finding F13.
Category: API/docs nit · Severity: low · Effort: small
Problem
docs/API.md:148-151 says fields may briefly read as "empty arrays" after startup, but a nil []Disk marshals as null (internal/collector/types.go:130 — disks has no omitempty, unlike network). Strict JSON consumers iterating disks will trip on null.
Suggested fix
Pick one and make it consistent: initialize the slices so they marshal as [], add omitempty to match network, or correct the sentence in API.md. Note that adding omitempty changes the v1 shape for existing consumers (field disappears instead of null) — initializing to [] is the safest option.
Source: Full code review 2026-07-17 (
docs/reviews/2026-07-17-full-code-review.md), finding F13.Category: API/docs nit · Severity: low · Effort: small
Problem
docs/API.md:148-151says fields may briefly read as "empty arrays" after startup, but a nil[]Diskmarshals asnull(internal/collector/types.go:130—diskshas noomitempty, unlikenetwork). Strict JSON consumers iteratingdiskswill trip onnull.Suggested fix
Pick one and make it consistent: initialize the slices so they marshal as
[], addomitemptyto matchnetwork, or correct the sentence in API.md. Note that addingomitemptychanges the v1 shape for existing consumers (field disappears instead ofnull) — initializing to[]is the safest option.