From 9bc4d217391464762d77fe3c6abb1fac6326321d Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Sun, 15 Feb 2026 12:44:52 +0000 Subject: [PATCH] enable unparam linter --- .golangci.yml | 2 +- cmd/x32-cli/info.go | 2 +- cmd/x32-cli/snapshot.go | 24 ++++++++++++------------ cmd/xair-cli/info.go | 2 +- cmd/xair-cli/snapshot.go | 2 +- internal/xair/parser.go | 4 ++-- internal/xair/util.go | 2 +- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 8fcf443..c3f70b0 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -6,7 +6,7 @@ run: go: '1.24' linters: - disable: [dupl, errcheck, goconst, godot, staticcheck, unparam, predeclared] + disable: [dupl, errcheck, goconst, godot, staticcheck, predeclared] enable: # Default enabled linters - errcheck # Check for unchecked errors diff --git a/cmd/x32-cli/info.go b/cmd/x32-cli/info.go index 7b4db3e..8cb7c5b 100644 --- a/cmd/x32-cli/info.go +++ b/cmd/x32-cli/info.go @@ -4,7 +4,7 @@ import "fmt" type InfoCmd struct{} -func (c *InfoCmd) Run(ctx *context) error { +func (cmd *InfoCmd) Run(ctx *context) error { // nolint: unparam fmt.Fprintf( ctx.Out, "Host: %s | Name: %s | Model: %s | Firmware: %s\n", diff --git a/cmd/x32-cli/snapshot.go b/cmd/x32-cli/snapshot.go index 91d3351..5bfa022 100644 --- a/cmd/x32-cli/snapshot.go +++ b/cmd/x32-cli/snapshot.go @@ -14,12 +14,12 @@ type SnapshotCmdGroup struct { } // Validate checks if the provided snapshot index is within the valid range (1-64) when any of the subcommands that require an index are used. -func (c *SnapshotCmdGroup) Validate() error { - if c.Index.Index == nil { +func (cmd *SnapshotCmdGroup) Validate() error { + if cmd.Index.Index == nil { return nil } - if *c.Index.Index < 1 || *c.Index.Index > 64 { + if *cmd.Index.Index < 1 || *cmd.Index.Index > 64 { return fmt.Errorf("snapshot index must be between 1 and 64") } @@ -28,11 +28,11 @@ func (c *SnapshotCmdGroup) Validate() error { type ListCmd struct{} -func (c *ListCmd) Run(ctx *context) error { +func (cmd *ListCmd) Run(ctx *context) error { for i := range 64 { name, err := ctx.Client.Snapshot.Name(i + 1) if err != nil { - break + return fmt.Errorf("failed to get name for snapshot %d: %w", i+1, err) } if name == "" { continue @@ -46,8 +46,8 @@ type NameCmd struct { Name *string `arg:"" help:"The name of the snapshot." optional:""` } -func (c *NameCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error { - if c.Name == nil { +func (cmd *NameCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error { + if cmd.Name == nil { name, err := ctx.Client.Snapshot.Name(*snapshot.Index.Index) if err != nil { return err @@ -56,15 +56,15 @@ func (c *NameCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error { return nil } - return ctx.Client.Snapshot.SetName(*snapshot.Index.Index, *c.Name) + return ctx.Client.Snapshot.SetName(*snapshot.Index.Index, *cmd.Name) } type SaveCmd struct { Name string `arg:"" help:"The name of the snapshot."` } -func (c *SaveCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error { - err := ctx.Client.Snapshot.CurrentName(c.Name) +func (cmd *SaveCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error { + err := ctx.Client.Snapshot.CurrentName(cmd.Name) if err != nil { return err } @@ -74,12 +74,12 @@ func (c *SaveCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error { type LoadCmd struct{} -func (c *LoadCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error { +func (cmd *LoadCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error { return ctx.Client.Snapshot.CurrentLoad(*snapshot.Index.Index) } type DeleteCmd struct{} -func (c *DeleteCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error { +func (cmd *DeleteCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error { return ctx.Client.Snapshot.CurrentDelete(*snapshot.Index.Index) } diff --git a/cmd/xair-cli/info.go b/cmd/xair-cli/info.go index 7b4db3e..8cb7c5b 100644 --- a/cmd/xair-cli/info.go +++ b/cmd/xair-cli/info.go @@ -4,7 +4,7 @@ import "fmt" type InfoCmd struct{} -func (c *InfoCmd) Run(ctx *context) error { +func (cmd *InfoCmd) Run(ctx *context) error { // nolint: unparam fmt.Fprintf( ctx.Out, "Host: %s | Name: %s | Model: %s | Firmware: %s\n", diff --git a/cmd/xair-cli/snapshot.go b/cmd/xair-cli/snapshot.go index 91d3351..f854da5 100644 --- a/cmd/xair-cli/snapshot.go +++ b/cmd/xair-cli/snapshot.go @@ -32,7 +32,7 @@ func (c *ListCmd) Run(ctx *context) error { for i := range 64 { name, err := ctx.Client.Snapshot.Name(i + 1) if err != nil { - break + return fmt.Errorf("failed to get name for snapshot %d: %w", i+1, err) } if name == "" { continue diff --git a/internal/xair/parser.go b/internal/xair/parser.go index 9cea636..23872da 100644 --- a/internal/xair/parser.go +++ b/internal/xair/parser.go @@ -76,7 +76,7 @@ func (p *xairParser) extractOSCAddress(data []byte) (address string, nextPos int func (p *xairParser) extractOSCTypeTags( data []byte, start int, -) (typeTags string, nextPos int, err error) { +) (typeTags string, nextPos int, err error) { // nolint: unparam if start >= len(data) { return "", start, nil // No type tags available } @@ -105,7 +105,7 @@ func (p *xairParser) parseOSCArguments( argsStart int, typeTags string, msg *osc.Message, -) error { +) error { // nolint: unparam argData := data[argsStart:] argNum := 0 diff --git a/internal/xair/util.go b/internal/xair/util.go index fa30fca..97dec7b 100644 --- a/internal/xair/util.go +++ b/internal/xair/util.go @@ -52,7 +52,7 @@ func mustDbFrom(level float64) float64 { } } -func toFixed(num float64, precision int) float64 { +func toFixed(num float64, precision int) float64 { // nolint: unparam output := math.Pow(10, float64(precision)) return float64(math.Round(num*output)) / output }