Skip to content
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

Replace github.com/pkg/errors with standard library errors package #1688

Merged
merged 5 commits into from
Dec 6, 2024

Commits on Dec 5, 2024

  1. Errors cleanups in drplacementcontrol_controller

    - Rename "k8s.io/apimachinery/pkg/api/errors" to "k8serrors"
    - Replace "github.com/pkg/errors" with "errors" package
    - Replace usage of errors.Wrap() with fmt.Errorf("...: %w", err)
    
    Part-of: RamenDR#1678
    Signed-off-by: Nir Soffer <[email protected]>
    nirs committed Dec 5, 2024
    Configuration menu
    Copy the full SHA
    701a4bf View commit details
    Browse the repository at this point in the history
  2. Rename error to make revive linter happy

    Replacing the "github.com/pkg/errors" with "errors" reveal a lint issue
    with the revive linter:
    
        InitialWaitTimeForDRPCPlacementRule should have name of the form ErrFoo (revive)
    
    While fixing, remove pointless wrapping. errors.Is() is documented to
    match any error in err's tree including err itself.
    
    Part-of: RamenDR#1678
    Signed-off-by: Nir Soffer <[email protected]>
    nirs committed Dec 5, 2024
    Configuration menu
    Copy the full SHA
    d920c81 View commit details
    Browse the repository at this point in the history
  3. Import apimachinery api errors as k8serrors

    So we can use the standard library errors package.
    
    Part-of: RamenDR#1678
    Signed-off-by: Nir Soffer <[email protected]>
    nirs committed Dec 5, 2024
    Configuration menu
    Copy the full SHA
    41789cc View commit details
    Browse the repository at this point in the history
  4. Replace github.com/pkg/errors with standard errors

    The non standard:
    
        errors.Wrap(err, "msg")
    
    was replaced with:
    
        fmt.Errorf("msg: %w", err)
    
    Fixes: RamenDR#1678
    Signed-off-by: Nir Soffer <[email protected]>
    nirs committed Dec 5, 2024
    Configuration menu
    Copy the full SHA
    ba5f2dc View commit details
    Browse the repository at this point in the history
  5. Fix errors to make revive happy

    - Add Err prefix
    - Remove unneeded error type
    - Start error message with lower letter (Waiting -> waiting)
    - Remove tailing punctuation (...)
    
    Signed-off-by: Nir Soffer <[email protected]>
    nirs committed Dec 5, 2024
    Configuration menu
    Copy the full SHA
    ecb9967 View commit details
    Browse the repository at this point in the history