fix: resolve golangci-lint v2.1.6 staticcheck failures
All checks were successful
CI / Test (push) Successful in 17s
Release / Create Release (push) Successful in 1m33s
CI / Lint (push) Successful in 22s
CI / Build (push) Successful in 20s

- SA9003 (empty branch): rewrote TestFormatLargeAndScientific to actually
  call FormatForDisplay and perform a minimal non-empty assertion instead of
  an if-with-no-body.
- SA1019 (deprecated keyStyle.Copy()): replaced all .Copy() with direct
  assignment or method chaining on the base keyStyle. lipgloss styles are
  immutable and their builder methods already return new instances.
- Removed now-unused "strings" import from calc_test.go.
- All changes pass go test -short, go build, go vet, and gofmt.

This makes the Lint job (which runs golangci-lint-action + staticcheck) green.
The v0.3.0 tag was already pushed from the prior commit; this is master
hygiene so future CI + any follow-up tags are clean.
This commit is contained in:
Grok 2026-06-06 17:09:43 +01:00
parent 17303d1446
commit 700e70a355
2 changed files with 10 additions and 8 deletions

View File

@ -2,7 +2,6 @@ package calc
import (
"errors"
"strings"
"testing"
)
@ -240,8 +239,11 @@ func TestNegativeInBases(t *testing.T) {
func TestFormatLargeAndScientific(t *testing.T) {
e := NewEngine()
e.accumulator = 1e15
if got := e.FormatForDisplay(); !strings.Contains(got, "e") && !strings.Contains(got, "E") {
// may or not, but check no panic
got := e.FormatForDisplay()
// Large values may or may not use scientific notation (depending on FormatForDisplay
// rules and current base); the primary purpose of this test is to ensure no panic.
if got == "" {
t.Error("FormatForDisplay returned empty for large accumulator value")
}
}

View File

@ -230,11 +230,11 @@ func (a *App) View() string {
Align(lipgloss.Center)
// Specialized key styles for visual grouping (like real calculators).
numKey := keyStyle.Copy()
opKey := keyStyle.Copy().Foreground(lipgloss.Color("63")).Background(lipgloss.Color("235"))
clearKey := keyStyle.Copy().Foreground(lipgloss.Color("203")).Background(lipgloss.Color("52"))
modKey := keyStyle.Copy().Foreground(lipgloss.Color("214")) // orange-ish for MOD
hexKey := keyStyle.Copy().Foreground(lipgloss.Color("214")).Background(lipgloss.Color("235")) // for A-F, only shown in HEX mode
numKey := keyStyle
opKey := keyStyle.Foreground(lipgloss.Color("63")).Background(lipgloss.Color("235"))
clearKey := keyStyle.Foreground(lipgloss.Color("203")).Background(lipgloss.Color("52"))
modKey := keyStyle.Foreground(lipgloss.Color("214")) // orange-ish for MOD
hexKey := keyStyle.Foreground(lipgloss.Color("214")).Background(lipgloss.Color("235")) // for A-F, only shown in HEX mode
makeKey := func(label string) string {
var st lipgloss.Style