Skip to content

Commit 374db8b

Browse files
authored
Merge pull request #2509 from alexandear/fix-revive-error-strings
Uncapitalize error messages; enable revive.error-strings
2 parents f1fca7e + 2db1cf3 commit 374db8b

File tree

8 files changed

+10
-6
lines changed

8 files changed

+10
-6
lines changed

.golangci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ linters-settings:
106106
errorlint:
107107
asserts: false
108108
revive:
109+
# Set below 0.8 to enable error-strings
110+
confidence: 0.6
109111
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md
110112
rules:
111113
- name: blank-imports

cmd/limactl/copy.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func copyAction(cmd *cobra.Command, args []string) error {
9898
}
9999
}
100100
if legacySSH && len(instDirs) > 1 {
101-
return fmt.Errorf("More than one (instance) host is involved in this command, this is only supported for openSSH v8.0 or higher")
101+
return fmt.Errorf("more than one (instance) host is involved in this command, this is only supported for openSSH v8.0 or higher")
102102
}
103103
scpFlags = append(scpFlags, "-3", "--")
104104
scpArgs = append(scpFlags, scpArgs...)

cmd/limactl/disk.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func newDiskCommand() *cobra.Command {
2727
2828
Delete a disk:
2929
$ limactl disk delete DISK
30-
30+
3131
Resize a disk:
3232
$ limactl disk resize DISK --size SIZE`,
3333
SilenceUsage: true,
@@ -106,7 +106,7 @@ func diskCreateAction(cmd *cobra.Command, args []string) error {
106106
if rerr != nil {
107107
err = errors.Join(err, fmt.Errorf("failed to remove a directory %q: %w", diskDir, rerr))
108108
}
109-
return fmt.Errorf("Failed to create %s disk in %q: %w", format, diskDir, err)
109+
return fmt.Errorf("failed to create %s disk in %q: %w", format, diskDir, err)
110110
}
111111

112112
return nil

pkg/qemu/entitlementutil/entitlementutil.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func Sign(qExe string) error {
5151
</dict>
5252
</plist>`
5353
if _, err = ent.WriteString(entXML); err != nil {
54-
return fmt.Errorf("Failed to write to a temporary file %q for signing QEMU binary: %w", entName, err)
54+
return fmt.Errorf("failed to write to a temporary file %q for signing QEMU binary: %w", entName, err)
5555
}
5656
ent.Close()
5757
signCmd := exec.Command("codesign", "--sign", "-", "--entitlements", entName, "--force", qExe)

pkg/qemu/qemu.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,7 @@ func FindVirtiofsd(qemuExe string) (string, error) {
998998
}
999999
}
10001000

1001-
return "", errors.New("Failed to locate virtiofsd")
1001+
return "", errors.New("failed to locate virtiofsd")
10021002
}
10031003

10041004
func VirtiofsdCmdline(cfg Config, mountIndex int) ([]string, error) {

pkg/qemu/qemu_driver.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ func (l *LimaQemuDriver) killVhosts() error {
288288
var errs []error
289289
for i, vhost := range l.vhostCmds {
290290
if err := vhost.Process.Kill(); err != nil && !errors.Is(err, os.ErrProcessDone) {
291-
errs = append(errs, fmt.Errorf("Failed to kill virtiofsd instance #%d: %w", i, err))
291+
errs = append(errs, fmt.Errorf("failed to kill virtiofsd instance #%d: %w", i, err))
292292
}
293293
}
294294

pkg/vz/errors_darwin.go

+1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ package vz
44

55
import "errors"
66

7+
//nolint:revive // error-strings
78
var errRosettaUnsupported = errors.New("Rosetta is unsupported on non-ARM64 hosts")

pkg/vz/vz_driver_darwin.go

+1
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ func (l *LimaVzDriver) RunGUI() error {
182182
if l.CanRunGUI() {
183183
return l.machine.StartGraphicApplication(1920, 1200)
184184
}
185+
//nolint:revive // error-strings
185186
return fmt.Errorf("RunGUI is not supported for the given driver '%s' and display '%s'", "vz", *l.Yaml.Video.Display)
186187
}
187188

0 commit comments

Comments
 (0)