Skip to content

Commit 5692b29

Browse files
committed
fix: Resolve all golangci-lint warnings
Fix 7 linting issues reported by golangci-lint: - binance.go: Check fmt.Sscanf return value (errcheck) - scroll_test.go: Remove ineffectual assignment to visibleData (ineffassign) - binance_test.go: Use type inference for f64 and i variables (staticcheck) - scroll.go: Merge conditional assignment into variable declaration (staticcheck) - scroll.go: Remove unused mouseCallback and touchCallback fields (unused) All WASM tests still pass. Zero linting issues remain.
1 parent 4ae5175 commit 5692b29

4 files changed

Lines changed: 6 additions & 12 deletions

File tree

examples/webgpu-chart/binance.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func parseFloat(val interface{}) float64 {
153153
return v
154154
case string:
155155
var f float64
156-
fmt.Sscanf(v, "%f", &f)
156+
_, _ = fmt.Sscanf(v, "%f", &f)
157157
// Handle NaN and Inf from parsed strings
158158
if math.IsNaN(f) || math.IsInf(f, 0) {
159159
return 0

examples/webgpu-chart/binance_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ func TestParseFloatPrecision(t *testing.T) {
6161

6262
func TestParseFloatTypes(t *testing.T) {
6363
// Test all supported types
64-
var f64 float64 = 123.456
65-
var i int = 42
64+
f64 := 123.456
65+
i := 42
6666
var i64 int64 = 999
6767

6868
if parseFloat(f64) != 123.456 {

examples/webgpu-chart/scroll.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ type ScrollManager struct {
2121
touchStartX float64
2222
touchStartY float64
2323
wheelCallback js.Func
24-
mouseCallback js.Func
25-
touchCallback js.Func
2624
keyCallback js.Func
2725
}
2826

@@ -100,12 +98,8 @@ func (cdm *ChartDataManager) ShiftViewport(delta int) bool {
10098
}
10199
}
102100

103-
// Check if we need to prefetch more data
104-
needsFetch := false
105-
if cdm.visibleEnd > len(cdm.allData)-cdm.prefetchSize {
106-
// Near the end, fetch older data
107-
needsFetch = true
108-
}
101+
// Check if we need to prefetch more data (near the end, fetch older data)
102+
needsFetch := cdm.visibleEnd > len(cdm.allData)-cdm.prefetchSize
109103

110104
// Return whether viewport actually changed
111105
return cdm.visibleStart != oldStart || cdm.visibleEnd != oldEnd || needsFetch

examples/webgpu-chart/scroll_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func TestGetVisibleDataBounds(t *testing.T) {
109109
// Test negative start
110110
cdm.visibleStart = -10
111111
cdm.visibleEnd = 50
112-
visibleData = cdm.GetVisibleData()
112+
_ = cdm.GetVisibleData()
113113

114114
if cdm.visibleStart != 0 {
115115
t.Errorf("Expected clamped start of 0, got %d", cdm.visibleStart)

0 commit comments

Comments
 (0)