Skip to content

fix: size flags accept the Kubernetes Gi spelling - #246

Merged
CMGS merged 1 commit into
masterfrom
fix/size-gi-spelling
Sep 14, 2026
Merged

CMGS merged 1 commit into
masterfrom
fix/size-gi-spelling

Conversation

@CMGS

@CMGS CMGS commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Why

--memory, --storage, --data-disk size= and gc --snapshot-size each handed their value straight to go-units, which reads 20G and 20GiB but rejects 20Gi, so a Kubernetes-shaped quantity failed on cocoon while cocoon-macos carried its own normaliser in front of the parser exported by #242.

What

types.ParseSize is the one rule for the family: trim, append B to a trailing i, then go-units. The four flags call it; ParseDataDiskSpec too. Every unit stays binary (20G is 20 GiB, as before); the CLI page says so next to the size flags. cocoon-macos can delete its parseSize at its next pin bump.

Evidence

  • GOWORK=off go build ./... on darwin and linux, go test ./types/ ./cmd/core/ ./cmd/others/ ok, make lint 0 issues on both platforms, asl clean, no comment beyond the one godoc.
  • Table test: 20G, 20Gi, 20GiB, 20gi all 20 GiB; 512Mi trimmed; bare 1024; 20i, empty and abc refused.

Closes #245

--memory, --storage, --data-disk size= and gc --snapshot-size each handed their value straight to go-units, which reads 20G and 20GiB but rejects 20Gi, so a Kubernetes-shaped quantity failed on cocoon while cocoon-macos carried its own normaliser. types.ParseSize is the one rule for the family: trim, append B to a trailing i, then go-units; every unit stays binary.

Closes #245
@CMGS
CMGS merged commit dd8e8de into master Sep 14, 2026
4 checks passed
@CMGS
CMGS deleted the fix/size-gi-spelling branch September 14, 2026 14:39
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.

types: ParseDataDiskSpec rejects the Kubernetes Gi spelling (20Gi)

1 participant