From 289bfb060585b4f09b6759f9fd77d6d61b9d2e61 Mon Sep 17 00:00:00 2001 From: "5684185+vsariola@users.noreply.github.com" <5684185+vsariola@users.noreply.github.com> Date: Sat, 21 Jun 2025 10:33:08 +0300 Subject: [PATCH] refactor: fix all unused parameter / variable warnings --- 4klang.go | 22 +++++++++++----------- tracker/derived.go | 2 +- tracker/gioui/buttons.go | 2 +- tracker/gioui/scroll_table.go | 1 - tracker/gioui/tracker.go | 1 - 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/4klang.go b/4klang.go index 8754108..af22de6 100644 --- a/4klang.go +++ b/4klang.go @@ -245,7 +245,7 @@ func read4klangUnit(r io.Reader, version int) ([]Unit, error) { } } -func read4klangENV(vals [15]byte, version int) []Unit { +func read4klangENV(vals [15]byte, _ int) []Unit { return []Unit{{ Type: "envelope", Parameters: map[string]int{ @@ -273,7 +273,7 @@ func read4klangVCO(vals [15]byte, version int) []Unit { color, v = int(v[0]), v[1:] shape, v = int(v[0]), v[1:] gain, v = int(v[0]), v[1:] - flags, v = int(v[0]), v[1:] + flags, _ = int(v[0]), v[1:] if flags&0x10 == 0x10 { lfo = 1 } @@ -318,7 +318,7 @@ func read4klangVCO(vals [15]byte, version int) []Unit { }} } -func read4klangVCF(vals [15]byte, version int) []Unit { +func read4klangVCF(vals [15]byte, _ int) []Unit { flags := vals[2] var stereo, lowpass, bandpass, highpass, neghighpass int if flags&0x01 == 0x01 { @@ -352,14 +352,14 @@ func read4klangVCF(vals [15]byte, version int) []Unit { } } -func read4klangDST(vals [15]byte, version int) []Unit { +func read4klangDST(vals [15]byte, _ int) []Unit { return []Unit{ {Type: "distort", Parameters: map[string]int{"drive": int(vals[0]), "stereo": int(vals[2])}}, {Type: "hold", Parameters: map[string]int{"holdfreq": int(vals[1]), "stereo": int(vals[2])}}, } } -func read4klangDLL(vals [15]byte, version int) []Unit { +func read4klangDLL(vals [15]byte, _ int) []Unit { var delaytimes []int var notetracking int if vals[11] > 0 { @@ -400,7 +400,7 @@ func read4klangDLL(vals [15]byte, version int) []Unit { }} } -func read4klangFOP(vals [15]byte, version int) []Unit { +func read4klangFOP(vals [15]byte, _ int) []Unit { var t string var stereo int switch vals[0] { @@ -434,7 +434,7 @@ func read4klangFOP(vals [15]byte, version int) []Unit { }} } -func read4klangFST(vals [15]byte, version int) []Unit { +func read4klangFST(vals [15]byte, _ int) []Unit { sendpop := 0 if vals[1]&0x40 == 0x40 { sendpop = 1 @@ -484,7 +484,7 @@ func fix4klangTargets(instrIndex int, instr Instrument, m _4klangTargetMap) { } } -func read4klangPAN(vals [15]byte, version int) []Unit { +func read4klangPAN(vals [15]byte, _ int) []Unit { return []Unit{{ Type: "pan", Parameters: map[string]int{ @@ -493,7 +493,7 @@ func read4klangPAN(vals [15]byte, version int) []Unit { }}} } -func read4klangOUT(vals [15]byte, version int) []Unit { +func read4klangOUT(vals [15]byte, _ int) []Unit { return []Unit{{ Type: "outaux", Parameters: map[string]int{ @@ -503,7 +503,7 @@ func read4klangOUT(vals [15]byte, version int) []Unit { }} } -func read4klangACC(vals [15]byte, version int) []Unit { +func read4klangACC(vals [15]byte, _ int) []Unit { c := 0 if vals[0] != 0 { c = 2 @@ -514,7 +514,7 @@ func read4klangACC(vals [15]byte, version int) []Unit { }} } -func read4klangFLD(vals [15]byte, version int) []Unit { +func read4klangFLD(vals [15]byte, _ int) []Unit { return []Unit{{ Type: "loadval", Parameters: map[string]int{"stereo": 0, "value": int(vals[0])}, diff --git a/tracker/derived.go b/tracker/derived.go index d45f471..1c4b789 100644 --- a/tracker/derived.go +++ b/tracker/derived.go @@ -316,7 +316,7 @@ func (m *Model) tracksWithSameInstrument(trackIndex int) iter.Seq[int] { func (m *Model) calcPatternUseCounts(track sointu.Track) []int { result := make([]int, len(m.d.Song.Score.Tracks)) - for j, _ := range result { + for j := range result { result[j] = 0 } for j := 0; j < m.d.Song.Score.Length; j++ { diff --git a/tracker/gioui/buttons.go b/tracker/gioui/buttons.go index 63f4575..8bf45b8 100644 --- a/tracker/gioui/buttons.go +++ b/tracker/gioui/buttons.go @@ -206,7 +206,7 @@ func (b *Clickable) Update(gtx layout.Context) (widget.Click, bool) { return b.update(b, gtx) } -func (b *Clickable) update(t event.Tag, gtx layout.Context) (widget.Click, bool) { +func (b *Clickable) update(_ event.Tag, gtx layout.Context) (widget.Click, bool) { for len(b.history) > 0 { c := b.history[0] if c.End.IsZero() || gtx.Now.Sub(c.End) < 1*time.Second { diff --git a/tracker/gioui/scroll_table.go b/tracker/gioui/scroll_table.go index db3946d..881c874 100644 --- a/tracker/gioui/scroll_table.go +++ b/tracker/gioui/scroll_table.go @@ -37,7 +37,6 @@ type ScrollTableStyle struct { ColumnTitleHeight unit.Dp CellWidth unit.Dp CellHeight unit.Dp - element func(gtx C, x, y int) D } func NewScrollTable(table tracker.Table, vertList, horizList tracker.List) *ScrollTable { diff --git a/tracker/gioui/tracker.go b/tracker/gioui/tracker.go index 60be672..81797d4 100644 --- a/tracker/gioui/tracker.go +++ b/tracker/gioui/tracker.go @@ -51,7 +51,6 @@ type ( filePathString tracker.String noteEvents []tracker.NoteEvent - execChan chan func() preferences Preferences *tracker.Model