Skip to content

Lowercase error strings to follow Go conventions #694

@mdryaan

Description

@mdryaan

Description

Go's error formatting convention states that error strings should not be capitalized or end with punctuation, because they are often embedded in larger error messages. When these errors are wrapped by callers, the resulting chain reads incorrectly (e.g. "outer: Could not open file"). The revive linter, enabled in .golangci.yml, flags capitalized error strings.

Affected locations include:

  • pkg/unikontainers/mount.go"Could not remount...", "Failed to set mount flags...", "Failed to set propagation flag..."
  • pkg/unikontainers/utils.go"Namespace %s was not found"
  • pkg/unikontainers/block.go"Could not move %s to %s: %w" (three instances)
  • pkg/unikontainers/shared_fs.go"Could not bind mount %s: %w"
  • pkg/unikontainers/unikernels/rumprun.go"Could not Marshal cmdline: %v", "Could not Marshal environment variable: %v"

Expected behavior: All error strings start with a lowercase letter, consistent with Go conventions and the project's linter configuration.

Current behavior: Multiple error strings start with an uppercase letter (e.g. "Could not...", "Failed to...", "Namespace %s was not found").

Proposed solution: Lowercase the first letter of each capitalized error string in the affected files. No change to logic, only to string content.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions