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

update golangci-lint version to v1.49.0 #4806

Merged

Conversation

koba1t
Copy link
Member

@koba1t koba1t commented Sep 22, 2022

Update golangci-lint v1.46.2 to v1.49.0
This update is improving the new go version support.

additional

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 22, 2022
@@ -204,7 +204,7 @@ func (s *StorageMount) String() string {
func GetFunctionSpec(n *yaml.RNode) (*FunctionSpec, error) {
meta, err := n.GetMeta()
if err != nil {
return nil, nil
return nil, fmt.Errorf("failed to get ResourceMeta: %w", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Although these may be good changes, they look unrelated to this PR. Is a new linter somehow triggering the need for them?

Copy link
Member Author

@koba1t koba1t Sep 22, 2022

Choose a reason for hiding this comment

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

It was caused by the nilerr with the new version.
That is not a new linter. That linter was enabled before creating this PR.

That lint would show the below errors if this line weren't fixed.

error is not nil (line 205) but it returns nil (nilerr)

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I see. This was probably done to make the function alpha as unlikely as possible to generate errors, but now that we're trying to move functions forward, I think you're right to return the error here. It would be very surprising to get an error here, and if somehow that happened, we don't know whether or not the metadata we failed to retrieve contained a function.

@koba1t
Copy link
Member Author

koba1t commented Sep 22, 2022

Hi, @KnVerey

Thanks to check this PR.
I replied to your comments. Could you recheck that?

@@ -204,7 +204,7 @@ func (s *StorageMount) String() string {
func GetFunctionSpec(n *yaml.RNode) (*FunctionSpec, error) {
meta, err := n.GetMeta()
if err != nil {
return nil, nil
return nil, fmt.Errorf("failed to get ResourceMeta: %w", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I see. This was probably done to make the function alpha as unlikely as possible to generate errors, but now that we're trying to move functions forward, I think you're right to return the error here. It would be very surprising to get an error here, and if somehow that happened, we don't know whether or not the metadata we failed to retrieve contained a function.

kyaml/fn/runtime/runtimeutil/functiontypes.go Outdated Show resolved Hide resolved
@@ -281,7 +281,8 @@ metadata:
out: []string{"gcr.io/example.com/image:v1.0.0"},
},

{name: "no function spec",
{
name: "no function spec",
Copy link
Contributor

Choose a reason for hiding this comment

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

Based on this title, I think this case is meant to ensure that we exit successfully when given a resource that simply does not contain a function. Unfortunately it didn't use a valid resource, so it is surfacing the error now. I think it is good to have the error test case too though! Would you mind changing the title here to something like "invalid input object" and restoring the original case but with a well-formed object?

Copy link
Member Author

@koba1t koba1t Sep 23, 2022

Choose a reason for hiding this comment

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

Unfortunately it didn't use a valid resource, so it is surfacing the error now.

Oh, I didn't find that.
I restored the original test case at 6ce230f.

@k8s-ci-robot
Copy link
Contributor

@koba1t: This PR has multiple commits, and the default merge method is: merge.
You can request commits to be squashed using the label: tide/merge-method-squash

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 23, 2022
@koba1t
Copy link
Member Author

koba1t commented Sep 23, 2022

Hi, @KnVerey
I fixed problems on test cases. Could you recheck this?

@KnVerey
Copy link
Contributor

KnVerey commented Sep 23, 2022

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 23, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: KnVerey, koba1t

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 23, 2022
@k8s-ci-robot k8s-ci-robot merged commit 65aeefd into kubernetes-sigs:master Sep 23, 2022
@koba1t koba1t deleted the chore/update_golangci-lint_v1.49.0 branch September 23, 2022 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants