Skip to content

refactor: replace formatBytes with humanize.IBytes - #2

Merged
deevus merged 1 commit into
mainfrom
refactor/use-humanize
Feb 28, 2026
Merged

refactor: replace formatBytes with humanize.IBytes#2
deevus merged 1 commit into
mainfrom
refactor/use-humanize

Conversation

@deevus

@deevus deevus commented Feb 28, 2026

Copy link
Copy Markdown
Owner

Summary

  • Replace hand-rolled formatBytes function with humanize.IBytes() from dustin/go-humanize, which was already an indirect dependency
  • Delete TestFormatBytes (now testing library code)
  • Net -36 lines

Details

The 12-line formatBytes in cmd/root.go reimplemented humanize.IBytes() identically. Since go-humanize was already in the dependency graph (pulled in by truenas-go), this is a pure code reduction with no new dependencies — just promotes it from indirect to direct.

Test plan

  • go build compiles
  • go test ./... all pass
  • go vet ./... clean

@github-actions

Copy link
Copy Markdown
⬇️ Go test coverage decreased from 27.1% to 26.5% compared to a683de1
⚠️ 2 of 8 packages have zero coverage.
  • github.com/deevus/pixels
  • github.com/deevus/pixels/internal/cache

Updated Package Coverages:

# Package Name                 |  Prior |    New
- github.com/deevus/pixels/cmd |   8.1% |   6.8%
View coverage for all packages
# Package Name                              | Coverage
- github.com/deevus/pixels                  |     0.0%
+ github.com/deevus/pixels/cmd              |     6.8%
- github.com/deevus/pixels/internal/cache   |     0.0%
+ github.com/deevus/pixels/internal/config  |    85.2%
+ github.com/deevus/pixels/internal/dataset |   100.0%
+ github.com/deevus/pixels/internal/egress  |    93.5%
+ github.com/deevus/pixels/internal/ssh     |    24.1%
+ github.com/deevus/pixels/internal/truenas |    68.5%

@deevus
deevus merged commit 206fe28 into main Feb 28, 2026
2 checks passed
@deevus
deevus deleted the refactor/use-humanize branch February 28, 2026 04:50
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.

1 participant