Skip to content

refactor: drop trivial helpers, use new(v) and data.DateLayout#958

Merged
cpcloud merged 2 commits intomicasa-dev:mainfrom
cpcloud:worktree-noble-herding-bumblebee
Apr 19, 2026
Merged

refactor: drop trivial helpers, use new(v) and data.DateLayout#958
cpcloud merged 2 commits intomicasa-dev:mainfrom
cpcloud:worktree-noble-herding-bumblebee

Conversation

@cpcloud
Copy link
Copy Markdown
Collaborator

@cpcloud cpcloud commented Apr 19, 2026

Summary

  • Remove fmtIntAlways and fmtSize wrappers in cmd/micasa/show.go; inline strconv.Itoa / strconv.FormatInt at call sites.
  • Collapse if val { return "true" } return "false" in ops_tree.go to strconv.FormatBool.
  • Delete ptr[T any] test helpers in internal/data and internal/app in favor of Go 1.26's new(v) builtin; deduplicate scattered ptr / ptrTime closures in dashboard_test.go into one package-level ptrTime.
  • Have fmtMoney delegate to fmtMoneyVal instead of duplicating the format string.
  • Replace hardcoded "2006-01-02" literals with the existing data.DateLayout constant where the same package already used it.
  • Inline jn() test helper in internal/extract/shadow_test.go; call sites read the same as json.Number(...) without the indirection.

- Remove fmtIntAlways and fmtSize wrappers in cmd/micasa/show.go;
  inline strconv.Itoa / strconv.FormatInt at call sites.
- Replace if-val-"true"/"false" ladder in ops_tree.go with
  strconv.FormatBool.
- Delete ptr[T any] helpers in internal/data and internal/app tests
  in favor of Go 1.26 new(v) builtin. Deduplicate ptr and ptrTime
  closures in dashboard_test.go into one package-level ptrTime.
- fmtMoney now delegates to fmtMoneyVal instead of duplicating the
  format string.
- Replace hardcoded "2006-01-02" with existing data.DateLayout
  constant where the same package already used it elsewhere.
@cpcloud cpcloud added the refactor Code restructuring without behavior change label Apr 19, 2026
The jn helper was a one-line wrapper that returned json.Number(s).
Inlining removes the indirection; the result reads the same at
call sites and drops an unnecessary name to remember.
@cpcloud cpcloud merged commit 4291d12 into micasa-dev:main Apr 19, 2026
28 checks passed
@cpcloud cpcloud deleted the worktree-noble-herding-bumblebee branch April 19, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Code restructuring without behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant