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

errwrap linting errors: call could wrap the error with error-wrapping directive %w #564

Open
atc0005 opened this issue Mar 28, 2023 · 2 comments
Assignees
Labels
bug Something isn't working linting
Milestone

Comments

@atc0005
Copy link
Owner

atc0005 commented Mar 28, 2023

Surfaced by errwrap v1.5.0:

/__w/check-cert/check-cert/internal/netutils/net.go:354:27: call could wrap the error with error-wrapping directive %w
/__w/check-cert/check-cert/internal/netutils/net.go:592:26: call could wrap the error with error-wrapping directive %w
/__w/check-cert/check-cert/internal/config/config.go:167:11: call could wrap the error with error-wrapping directive %w
/__w/check-cert/check-cert/cmd/check_cert/annotations.go:76:48: call could wrap the error with error-wrapping directive %w
@atc0005 atc0005 added bug Something isn't working linting labels Mar 28, 2023
@atc0005 atc0005 added this to the v0.12.1 milestone Mar 28, 2023
@atc0005 atc0005 self-assigned this Mar 28, 2023
@atc0005
Copy link
Owner Author

atc0005 commented Mar 28, 2023

Surfaced by errwrap v1.5.0:

/__w/check-cert/check-cert/cmd/check_cert/annotations.go:76:48: call could wrap the error with error-wrapping directive %w

Reported this one upstream to the linter author/maintainer. This looks like a false-positive:

annotatedErrors = append(annotatedErrors, fmt.Errorf(
"%w: %s; %s",
err,
errRuntimeTimeoutReached,
runtimeTimeoutReachedAdvice,
))

@atc0005
Copy link
Owner Author

atc0005 commented Mar 28, 2023

Another likely false-positive:

/__w/check-cert/check-cert/internal/netutils/net.go:592:26: call could wrap the error with error-wrapping directive %w

return HostPattern{}, fmt.Errorf(
"%q invalid; %w: %s",
hostPattern,
ErrHostnameFailsNameResolution,
lookupErr.Error(),
)

This syntax would be supported in Go 1.20, but is not in Go 1.19 (linter intends to support back to Go 1.16).

atc0005 added a commit that referenced this issue Mar 29, 2023
Resolve two of four linting issues identified by the errwrap
linter.

The remaining two linting issues appear to be false-positives
and will be considered as part of future work.

refs GH-564
@atc0005 atc0005 modified the milestones: v0.12.1, Future Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working linting
Projects
None yet
Development

No branches or pull requests

1 participant