fix: size flags accept the Kubernetes Gi spelling - #246
Merged
Merged
Conversation
--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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
--memory,--storage,--data-disk size=andgc --snapshot-sizeeach handed their value straight to go-units, which reads20Gand20GiBbut rejects20Gi, 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.ParseSizeis the one rule for the family: trim, appendBto a trailingi, then go-units. The four flags call it;ParseDataDiskSpectoo. Every unit stays binary (20Gis 20 GiB, as before); the CLI page says so next to the size flags. cocoon-macos can delete itsparseSizeat its next pin bump.Evidence
GOWORK=off go build ./...on darwin and linux,go test ./types/ ./cmd/core/ ./cmd/others/ok,make lint0 issues on both platforms,aslclean, no comment beyond the one godoc.20G,20Gi,20GiB,20giall 20 GiB;512Mitrimmed; bare1024;20i, empty andabcrefused.Closes #245