Skip to content

Commit

Permalink
Merge pull request #2509 from alexandear/fix-revive-error-strings
Browse files Browse the repository at this point in the history
Uncapitalize error messages; enable revive.error-strings
  • Loading branch information
jandubois authored Jul 24, 2024
2 parents f1fca7e + 2db1cf3 commit 374db8b
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ linters-settings:
errorlint:
asserts: false
revive:
# Set below 0.8 to enable error-strings
confidence: 0.6
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md
rules:
- name: blank-imports
Expand Down
2 changes: 1 addition & 1 deletion cmd/limactl/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func copyAction(cmd *cobra.Command, args []string) error {
}
}
if legacySSH && len(instDirs) > 1 {
return fmt.Errorf("More than one (instance) host is involved in this command, this is only supported for openSSH v8.0 or higher")
return fmt.Errorf("more than one (instance) host is involved in this command, this is only supported for openSSH v8.0 or higher")
}
scpFlags = append(scpFlags, "-3", "--")
scpArgs = append(scpFlags, scpArgs...)
Expand Down
4 changes: 2 additions & 2 deletions cmd/limactl/disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func newDiskCommand() *cobra.Command {
Delete a disk:
$ limactl disk delete DISK
Resize a disk:
$ limactl disk resize DISK --size SIZE`,
SilenceUsage: true,
Expand Down Expand Up @@ -106,7 +106,7 @@ func diskCreateAction(cmd *cobra.Command, args []string) error {
if rerr != nil {
err = errors.Join(err, fmt.Errorf("failed to remove a directory %q: %w", diskDir, rerr))
}
return fmt.Errorf("Failed to create %s disk in %q: %w", format, diskDir, err)
return fmt.Errorf("failed to create %s disk in %q: %w", format, diskDir, err)
}

return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/qemu/entitlementutil/entitlementutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func Sign(qExe string) error {
</dict>
</plist>`
if _, err = ent.WriteString(entXML); err != nil {
return fmt.Errorf("Failed to write to a temporary file %q for signing QEMU binary: %w", entName, err)
return fmt.Errorf("failed to write to a temporary file %q for signing QEMU binary: %w", entName, err)
}
ent.Close()
signCmd := exec.Command("codesign", "--sign", "-", "--entitlements", entName, "--force", qExe)
Expand Down
2 changes: 1 addition & 1 deletion pkg/qemu/qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ func FindVirtiofsd(qemuExe string) (string, error) {
}
}

return "", errors.New("Failed to locate virtiofsd")
return "", errors.New("failed to locate virtiofsd")
}

func VirtiofsdCmdline(cfg Config, mountIndex int) ([]string, error) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/qemu/qemu_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ func (l *LimaQemuDriver) killVhosts() error {
var errs []error
for i, vhost := range l.vhostCmds {
if err := vhost.Process.Kill(); err != nil && !errors.Is(err, os.ErrProcessDone) {
errs = append(errs, fmt.Errorf("Failed to kill virtiofsd instance #%d: %w", i, err))
errs = append(errs, fmt.Errorf("failed to kill virtiofsd instance #%d: %w", i, err))
}
}

Expand Down
1 change: 1 addition & 0 deletions pkg/vz/errors_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ package vz

import "errors"

//nolint:revive // error-strings
var errRosettaUnsupported = errors.New("Rosetta is unsupported on non-ARM64 hosts")
1 change: 1 addition & 0 deletions pkg/vz/vz_driver_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ func (l *LimaVzDriver) RunGUI() error {
if l.CanRunGUI() {
return l.machine.StartGraphicApplication(1920, 1200)
}
//nolint:revive // error-strings
return fmt.Errorf("RunGUI is not supported for the given driver '%s' and display '%s'", "vz", *l.Yaml.Video.Display)
}

Expand Down

0 comments on commit 374db8b

Please sign in to comment.