enable unparam linter

This commit is contained in:
onyx-and-iris 2026-02-15 12:44:52 +00:00
parent 7a0d5c56e5
commit 9bc4d21739
7 changed files with 19 additions and 19 deletions

View File

@ -6,7 +6,7 @@ run:
go: '1.24' go: '1.24'
linters: linters:
disable: [dupl, errcheck, goconst, godot, staticcheck, unparam, predeclared] disable: [dupl, errcheck, goconst, godot, staticcheck, predeclared]
enable: enable:
# Default enabled linters # Default enabled linters
- errcheck # Check for unchecked errors - errcheck # Check for unchecked errors

View File

@ -4,7 +4,7 @@ import "fmt"
type InfoCmd struct{} type InfoCmd struct{}
func (c *InfoCmd) Run(ctx *context) error { func (cmd *InfoCmd) Run(ctx *context) error { // nolint: unparam
fmt.Fprintf( fmt.Fprintf(
ctx.Out, ctx.Out,
"Host: %s | Name: %s | Model: %s | Firmware: %s\n", "Host: %s | Name: %s | Model: %s | Firmware: %s\n",

View File

@ -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. // 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 { func (cmd *SnapshotCmdGroup) Validate() error {
if c.Index.Index == nil { if cmd.Index.Index == nil {
return 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") return fmt.Errorf("snapshot index must be between 1 and 64")
} }
@ -28,11 +28,11 @@ func (c *SnapshotCmdGroup) Validate() error {
type ListCmd struct{} type ListCmd struct{}
func (c *ListCmd) Run(ctx *context) error { func (cmd *ListCmd) Run(ctx *context) error {
for i := range 64 { for i := range 64 {
name, err := ctx.Client.Snapshot.Name(i + 1) name, err := ctx.Client.Snapshot.Name(i + 1)
if err != nil { if err != nil {
break return fmt.Errorf("failed to get name for snapshot %d: %w", i+1, err)
} }
if name == "" { if name == "" {
continue continue
@ -46,8 +46,8 @@ type NameCmd struct {
Name *string `arg:"" help:"The name of the snapshot." optional:""` Name *string `arg:"" help:"The name of the snapshot." optional:""`
} }
func (c *NameCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error { func (cmd *NameCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error {
if c.Name == nil { if cmd.Name == nil {
name, err := ctx.Client.Snapshot.Name(*snapshot.Index.Index) name, err := ctx.Client.Snapshot.Name(*snapshot.Index.Index)
if err != nil { if err != nil {
return err return err
@ -56,15 +56,15 @@ func (c *NameCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error {
return nil 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 { type SaveCmd struct {
Name string `arg:"" help:"The name of the snapshot."` Name string `arg:"" help:"The name of the snapshot."`
} }
func (c *SaveCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error { func (cmd *SaveCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error {
err := ctx.Client.Snapshot.CurrentName(c.Name) err := ctx.Client.Snapshot.CurrentName(cmd.Name)
if err != nil { if err != nil {
return err return err
} }
@ -74,12 +74,12 @@ func (c *SaveCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error {
type LoadCmd struct{} 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) return ctx.Client.Snapshot.CurrentLoad(*snapshot.Index.Index)
} }
type DeleteCmd struct{} 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) return ctx.Client.Snapshot.CurrentDelete(*snapshot.Index.Index)
} }

View File

@ -4,7 +4,7 @@ import "fmt"
type InfoCmd struct{} type InfoCmd struct{}
func (c *InfoCmd) Run(ctx *context) error { func (cmd *InfoCmd) Run(ctx *context) error { // nolint: unparam
fmt.Fprintf( fmt.Fprintf(
ctx.Out, ctx.Out,
"Host: %s | Name: %s | Model: %s | Firmware: %s\n", "Host: %s | Name: %s | Model: %s | Firmware: %s\n",

View File

@ -32,7 +32,7 @@ func (c *ListCmd) Run(ctx *context) error {
for i := range 64 { for i := range 64 {
name, err := ctx.Client.Snapshot.Name(i + 1) name, err := ctx.Client.Snapshot.Name(i + 1)
if err != nil { if err != nil {
break return fmt.Errorf("failed to get name for snapshot %d: %w", i+1, err)
} }
if name == "" { if name == "" {
continue continue

View File

@ -76,7 +76,7 @@ func (p *xairParser) extractOSCAddress(data []byte) (address string, nextPos int
func (p *xairParser) extractOSCTypeTags( func (p *xairParser) extractOSCTypeTags(
data []byte, data []byte,
start int, start int,
) (typeTags string, nextPos int, err error) { ) (typeTags string, nextPos int, err error) { // nolint: unparam
if start >= len(data) { if start >= len(data) {
return "", start, nil // No type tags available return "", start, nil // No type tags available
} }
@ -105,7 +105,7 @@ func (p *xairParser) parseOSCArguments(
argsStart int, argsStart int,
typeTags string, typeTags string,
msg *osc.Message, msg *osc.Message,
) error { ) error { // nolint: unparam
argData := data[argsStart:] argData := data[argsStart:]
argNum := 0 argNum := 0

View File

@ -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)) output := math.Pow(10, float64(precision))
return float64(math.Round(num*output)) / output return float64(math.Round(num*output)) / output
} }