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

PowerVS: Remove deprecated errors package #7544

Merged
merged 1 commit into from Oct 6, 2023

Conversation

hamzy
Copy link
Contributor

@hamzy hamzy commented Sep 29, 2023

Wrote a program [1] to remove all occurances of the go-lang errors package.

  1. https://github.com/hamzy/powervs-hack/tree/main/remove-errors

@hamzy
Copy link
Contributor Author

hamzy commented Sep 29, 2023

/retest

@hamzy hamzy force-pushed the PowerVS-remove-error-package branch 2 times, most recently from 157a8b4 to a22d0b7 Compare September 29, 2023 22:08
@hamzy
Copy link
Contributor Author

hamzy commented Sep 29, 2023

/assign @r4f4

Copy link
Contributor

@r4f4 r4f4 left a comment

Choose a reason for hiding this comment

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

Since you're changing the case-ness of some output messages, don't forget to update the unit tests that check for those messages.

@@ -2,7 +2,6 @@ package powervs

import (
"context"
"errors"
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the built-in errors lib, you don't need to remove this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I leave it in, then I get:

pkg/asset/installconfig/powervs/validation.go:5:2: "errors" imported and not used

And I would think that if I had used it in that file, then the compiler would complain if I didn't include it...

@@ -2,7 +2,7 @@ package validation

import (
"crypto/rand"
"errors"
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to remove.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one, I put back and it compiled fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But lint complains:

pkg/types/powervs/validation/platform_test.go:5:2: "errors" imported but not used (typecheck)
	"errors"

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes because you changed the line that used it below: errors.New(...). I was saying that those errors.New calls don't necessarily need to be replaced because they are using the built-in errors lib, not the archived github.com/pkg/errors package one.

@hamzy
Copy link
Contributor Author

hamzy commented Sep 30, 2023

Since you're changing the case-ness of some output messages, don't forget to update the unit tests that check for those messages.

Good catch! Updated...

@hamzy hamzy force-pushed the PowerVS-remove-error-package branch 6 times, most recently from 4133d7c to a88ea28 Compare October 2, 2023 21:30
@openshift-merge-robot
Copy link
Contributor

@hamzy: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/okd-images a88ea28 link true /test okd-images
ci/prow/images a88ea28 link true /test images
ci/prow/okd-scos-images a88ea28 link true /test okd-scos-images
ci/prow/e2e-aws-custom-security-groups a88ea28 link false /test e2e-aws-custom-security-groups
ci/prow/e2e-aws-ovn a88ea28 link true /test e2e-aws-ovn

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

Copy link
Contributor

@r4f4 r4f4 left a comment

Choose a reason for hiding this comment

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

/approve

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 3, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: r4f4

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 Oct 3, 2023
if vpcName == "" || vpcSubnet == "" {
return "", false, nil
}

vpc, err := m.client.GetVPCByName(ctx, vpcName)
if err != nil {
return "", false, errors.Wrap(err, "failed to get VPC")
return colonPercentW, false, fmt.Errorf("failed to get VPC: %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.

The usage here seems to have changed. This may need to be a separate commit for tracking purposes, as this doesn't look like it is only a change to remove the errors package as indicated in the PR. Same for all of the usages in this function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The usage here changed because of a new lint error. :(

Copy link
Contributor

Choose a reason for hiding this comment

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

@hamzy I don't see the PR history complaining about that being an empty string. I see the linter complaining about it since it was used multiple times. My concern was that you are returning something other than the empty string. Do you have an example output of the first complaint?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pkg/asset/installconfig/powervs/metadata.go:161:10: string `: %w` has 4 occurrences, make it a constant (goconst)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah I think I see what you are asking about... let me investigate...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@barbacbd I pushed a new version...

@hamzy hamzy force-pushed the PowerVS-remove-error-package branch from a88ea28 to bbc6b96 Compare October 3, 2023 13:31
@mjturek
Copy link
Contributor

mjturek commented Oct 3, 2023

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 3, 2023
@hamzy
Copy link
Contributor Author

hamzy commented Oct 3, 2023

/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 Oct 3, 2023
Wrote a program [1] to remove all occurances of the go-lang errors
package.

1) https://github.com/hamzy/powervs-hack/tree/main/remove-errors
@hamzy hamzy force-pushed the PowerVS-remove-error-package branch from bbc6b96 to df5bb10 Compare October 3, 2023 17:45
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Oct 3, 2023
@mjturek
Copy link
Contributor

mjturek commented Oct 4, 2023

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 4, 2023
@barbacbd
Copy link
Contributor

barbacbd commented Oct 4, 2023

/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 Oct 4, 2023
@barbacbd
Copy link
Contributor

barbacbd commented Oct 4, 2023

/retest-required

@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD 732271d and 2 for PR HEAD df5bb10 in total

@hamzy
Copy link
Contributor Author

hamzy commented Oct 5, 2023

/retest-required

@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD 3a738d8 and 1 for PR HEAD df5bb10 in total

@hamzy
Copy link
Contributor Author

hamzy commented Oct 5, 2023

/retest-required

@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD 3c3f41c and 0 for PR HEAD df5bb10 in total

@openshift-ci-robot
Copy link
Contributor

/hold

Revision df5bb10 was retested 3 times: holding

@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 Oct 6, 2023
@hamzy
Copy link
Contributor Author

hamzy commented Oct 6, 2023

/retest-required
/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 Oct 6, 2023
@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD 3c3f41c and 2 for PR HEAD df5bb10 in total

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 6, 2023

@hamzy: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-aws-custom-security-groups df5bb10 link false /test e2e-aws-custom-security-groups

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@hamzy
Copy link
Contributor Author

hamzy commented Oct 6, 2023

/retest-required

@openshift-ci openshift-ci bot merged commit b6e9f0b into openshift:master Oct 6, 2023
21 of 22 checks passed
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. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants