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 golint with revive linter #13973

Merged
merged 1 commit into from
Apr 23, 2022

Conversation

Luap99
Copy link
Member

@Luap99 Luap99 commented Apr 22, 2022

golint, scopelint and interfacer are deprecated. golint is replaced by
revive. This linter is better because it will also check for our error
style: error strings should not be capitalized or end with punctuation or a newline

scopelint is replaced by exportloopref (already endabled)
interfacer has no replacement but I do not think this linter is
important.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Apr 22, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Luap99

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 22, 2022
Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

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

LGTM
In case you need to rebase/repush, consider using fmt.Errorf instead of errors.Wrap{f}.

@@ -28,7 +27,7 @@ func Archive(w http.ResponseWriter, r *http.Request) {
case http.MethodHead, http.MethodGet:
handleHeadAndGet(w, r, decoder, runtime)
default:
utils.Error(w, http.StatusNotImplemented, errors.New(fmt.Sprintf("unsupported method: %v", r.Method)))
utils.Error(w, http.StatusNotImplemented, errors.Errorf("unsupported method: %v", r.Method))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
utils.Error(w, http.StatusNotImplemented, errors.Errorf("unsupported method: %v", r.Method))
utils.Error(w, http.StatusNotImplemented, fmt.Errorf("unsupported method: %v", r.Method))

@@ -49,7 +49,7 @@ type InMemoryManager struct {
// of locks.
func NewInMemoryManager(numLocks uint32) (Manager, error) {
if numLocks == 0 {
return nil, errors.Errorf("must provide a non-zero number of locks!")
return nil, errors.Errorf("must provide a non-zero number of locks")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return nil, errors.Errorf("must provide a non-zero number of locks")
return nil, fmt.Errorf("must provide a non-zero number of locks")

@@ -264,7 +264,7 @@ func (c *Container) handleRestartPolicy(ctx context.Context) (_ bool, retErr err
if c.ensureState(define.ContainerStateRunning, define.ContainerStatePaused) {
return false, nil
} else if c.state.State == define.ContainerStateUnknown {
return false, errors.Wrapf(define.ErrInternal, "invalid container state encountered in restart attempt!")
return false, errors.Wrapf(define.ErrInternal, "invalid container state encountered in restart attempt")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return false, errors.Wrapf(define.ErrInternal, "invalid container state encountered in restart attempt")
return false, fmt.Errorf("invalid container state encountered in restart attempt: %w", define.ErrInternal)

Copy link
Member

Choose a reason for hiding this comment

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

Yes lets do this as a global change separate from this PR.

@Luap99
Copy link
Member Author

Luap99 commented Apr 22, 2022

@vrothberg I would prefer to make such changes in a different commit/PR.
This will affect way more calls. If want to change we should change all.

golint, scopelint and interfacer are deprecated. golint is replaced by
revive. This linter is better because it will also check for our error
style: `error strings should not be capitalized or end with punctuation or a newline`

scopelint is replaced by exportloopref (already endabled)
interfacer has no replacement but I do not think this linter is
important.

Signed-off-by: Paul Holzinger <[email protected]>
@mheon
Copy link
Member

mheon commented Apr 22, 2022

LGTM

@mheon
Copy link
Member

mheon commented Apr 22, 2022

/lgtm
/hold

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 22, 2022
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 22, 2022
@TomSweeneyRedHat
Copy link
Member

LGTM
and happy green test buttons. I'll let @mheon reverse the hold, I'm not 100% sure he was holding for tests or for some other reason?

@rhatdan
Copy link
Member

rhatdan commented Apr 23, 2022

/hold cancel

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 23, 2022
@openshift-merge-robot openshift-merge-robot merged commit 2df9bdc into containers:main Apr 23, 2022
@Luap99 Luap99 deleted the linter-revive branch April 23, 2022 10:34
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 21, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants