Skip to content

Commit

Permalink
lint: Fix non-constant format string warnings
Browse files Browse the repository at this point in the history
This commit should fix these errors from recent golangci-lint:
  Error: pkg/config/virtio.go:273:23: printf: non-constant format string in call to fmt.Errorf (govet)
  				return fmt.Errorf(fmt.Sprintf("unexpected value for virtio-input %s option: %s", option.key, option.value))
  				                  ^
  Error: pkg/config/virtio.go:318:23: printf: non-constant format string in call to fmt.Errorf (govet)
  				return fmt.Errorf(fmt.Sprintf("Invalid value for virtio-gpu %s: %s", option.key, option.value))
  				                  ^
  Error: pkg/config/virtio.go:325:23: printf: non-constant format string in call to fmt.Errorf (govet)
  				return fmt.Errorf(fmt.Sprintf("Invalid value for virtio-gpu %s: %s", option.key, option.value))
  				                  ^

Signed-off-by: Christophe Fergeau <[email protected]>
  • Loading branch information
cfergeau committed Aug 22, 2024
1 parent 908a1bb commit 39da774
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/config/virtio.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ func (dev *VirtioInput) FromOptions(options []option) error {
switch option.key {
case VirtioInputPointingDevice, VirtioInputKeyboardDevice:
if option.value != "" {
return fmt.Errorf(fmt.Sprintf("unexpected value for virtio-input %s option: %s", option.key, option.value))
return fmt.Errorf("unexpected value for virtio-input %s option: %s", option.key, option.value)
}
dev.InputType = option.key
default:
Expand Down Expand Up @@ -315,14 +315,14 @@ func (dev *VirtioGPU) FromOptions(options []option) error {
case VirtioGPUResolutionHeight:
height, err := strconv.Atoi(option.value)
if err != nil || height < 1 {
return fmt.Errorf(fmt.Sprintf("Invalid value for virtio-gpu %s: %s", option.key, option.value))
return fmt.Errorf("Invalid value for virtio-gpu %s: %s", option.key, option.value)
}

dev.Height = height
case VirtioGPUResolutionWidth:
width, err := strconv.Atoi(option.value)
if err != nil || width < 1 {
return fmt.Errorf(fmt.Sprintf("Invalid value for virtio-gpu %s: %s", option.key, option.value))
return fmt.Errorf("Invalid value for virtio-gpu %s: %s", option.key, option.value)
}

dev.Width = width
Expand Down

0 comments on commit 39da774

Please sign in to comment.