Skip to content

Uncapitalize error messages; enable revive.error-strings #2509

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 24, 2024

Conversation

alexandear
Copy link
Member

The PR fixes error messages according to the https://go.dev/wiki/CodeReviewComments#error-strings

Error strings should not be capitalized (unless beginning with proper nouns or acronyms) or end with punctuation, since they are usually printed following other context.

Also, enables revive.error-strings to automatically detect this with golangci-lint.

Details
❯ golangci-lint run
pkg/qemu/qemu.go:1001:24: error-strings: error strings should not be capitalized or end with punctuation or a newline (revive)
        return "", errors.New("Failed to locate virtiofsd")
                              ^
pkg/qemu/qemu_driver.go:291:35: error-strings: error strings should not be capitalized or end with punctuation or a newline (revive)
                        errs = append(errs, fmt.Errorf("Failed to kill virtiofsd instance #%d: %w", i, err))
                                                       ^
pkg/qemu/entitlementutil/entitlementutil.go:54:21: error-strings: error strings should not be capitalized or end with punctuation or a newline (revive)
                return fmt.Errorf("Failed to write to a temporary file %q for signing QEMU binary: %w", entName, err)
                                  ^
pkg/vz/vz_driver_darwin.go:185:20: error-strings: error strings should not be capitalized or end with punctuation or a newline (revive)
        return fmt.Errorf("RunGUI is not supported for the given driver '%s' and display '%s'", "vz", *l.Yaml.Video.Display)
                          ^
pkg/vz/errors_darwin.go:7:40: error-strings: error strings should not be capitalized or end with punctuation or a newline (revive)
var errRosettaUnsupported = errors.New("Rosetta is unsupported on non-ARM64 hosts")
                                       ^
cmd/limactl/copy.go:101:21: error-strings: error strings should not be capitalized or end with punctuation or a newline (revive)
                return fmt.Errorf("More than one (instance) host is involved in this command, this is only supported for openSSH v8.0 or higher")
                                  ^
cmd/limactl/disk.go:109:21: error-strings: error strings should not be capitalized or end with punctuation or a newline (revive)
                return fmt.Errorf("Failed to create %s disk in %q: %w", format, diskDir, err)
                                  ^

Copy link
Member

@jandubois jandubois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM

@jandubois jandubois merged commit 374db8b into lima-vm:master Jul 24, 2024
27 checks passed
@alexandear alexandear deleted the fix-revive-error-strings branch July 24, 2024 18:33
@AkihiroSuda AkihiroSuda added this to the v1.0 (tentative) milestone Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants