Skip to content

fix(slice-011): code correctness and clarity improvements#12

Merged
fredericomozzato merged 1 commit into
mainfrom
feat/011-code-correctness-clarity
Apr 14, 2026
Merged

fix(slice-011): code correctness and clarity improvements#12
fredericomozzato merged 1 commit into
mainfrom
feat/011-code-correctness-clarity

Conversation

@fredericomozzato
Copy link
Copy Markdown
Owner

Summary

  • Fix silently dropped io.ReadAll errors in internal/api/coingecko.go — both FetchMarkets and FetchPrices now propagate read errors from non-2xx response bodies instead of ignoring them
  • Replace magic numbers with named constants in internal/ui/markets.gocoinFetchLimit (100), refreshInterval (60s), grouped alongside existing staleThreshold
  • Add documentation comments in cmd/crypto-tracker/main.go — cancellation safety assumption for shutdown and DB lifecycle ownership
  • Expand comment explaining the background message broadcast pattern in internal/ui/app.go

Test Plan

  • make check passes (fmt, lint, test, vuln)
  • Error messages from CoinGecko client still include status code and body when available
  • No change in runtime behaviour — constants match previous literal values

- Fix ignored io.ReadAll errors in coingecko.go FetchMarkets and FetchPrices
- Add named constants for magic numbers in markets.go (coinFetchLimit, refreshInterval)
- Add cancellation safety comment in main.go
- Add DB lifecycle ownership comment in main.go
- Add broadcast pattern explanation comment in app.go
@fredericomozzato fredericomozzato merged commit b0398ed into main Apr 14, 2026
5 checks passed
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