formatter: round CREATED durations consistently with Docker Desktop#6978
formatter: round CREATED durations consistently with Docker Desktop#6978texasich wants to merge 1 commit into
Conversation
|
These are vendor generated files, not sure modifying these is acceptable or not. The root fix is in |
|
good catch — agreed we should avoid hand-editing generated/vendor files when possible. i’ll rework this so the change comes from the non-vendored source path (or isolate the minimal safe workaround if upstream is effectively frozen), then update this PR with the exact provenance in the description so maintainers can audit it quickly. |
|
👋 Gentle nudge — checking in to see if a maintainer might have bandwidth to take a look. The author noted the vendor concern and is planning to rework the approach. Happy to help move this forward however makes sense. Thanks! |
ca6893e to
adc5028
Compare
Move the HumanDuration rounding fix from vendored go-units into docker/cli's own code (internal/duration package) per reviewer feedback that vendor files should not be hand-edited. - New package: internal/duration/ with consistent rounding at all unit boundaries (day/week/month/year) using roundDuration helper - Update all 9 callers across 7 packages to use the new package - Files that still use other go-units functions keep the existing import - Tested: 23 unit tests pass for the new duration package The vendored go-units remains untouched. This is the same rounding logic but lives in non-vendored code, so CI and DCO pass cleanly. Fixes docker#6891
adc5028 to
42e7101
Compare
|
Reworked per review feedback — moved the duration rounding logic out of vendored Changes:
Same rounding behavior as before, just lives in non-vendored code now. |
Summary
docker/go-unitsHumanDuration rounding logic proposed in duration: extract roundDuration helper and round consistently go-units#51CREATEDoutputWhy
Fixes inconsistency reported in #6891 where CLI
CREATEDvalues diverge from Docker Desktop due to flooring vs rounding behavior.Scope notes
go-unitsduration formatting used by CLI outputValidation
GO111MODULE=off go test ./vendor/github.com/docker/go-units -run TestHumanDuration -count=1GO111MODULE=off go test ./vendor/github.com/docker/go-units -run ExampleHumanDuration -count=1Fixes #6891