Skip to content

API nit: disks is null (not []) before the first tick, contradicting API.md #70

Description

@LarsLaskowski

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:130disks 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions