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

Delete ioutil as it is Deprecated since Go 1.16 #3157

Merged
merged 2 commits into from
May 11, 2023
Merged

Delete ioutil as it is Deprecated since Go 1.16 #3157

merged 2 commits into from
May 11, 2023

Conversation

yanggangtony
Copy link
Member

Delete ioutil as it is Deprecated since Go 1.16
ioutil info.

// Deprecated: As of Go 1.16, the same functionality is now provided
// by package [io] or package [os], and those implementations
// should be preferred in new code.
// See the specific function documentation for details.

We can use os and io package for the same logic in the future.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 2, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @yanggangtony. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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 the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Apr 2, 2023
@k8s-ci-robot
Copy link
Contributor

Welcome @yanggangtony!

It looks like this is your first PR to kubernetes-sigs/kind 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/kind has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 2, 2023
@stmcginnis
Copy link
Contributor

The kind project still supports Go versions back to 1.14. The replacements did not exist in the older releases. It should eventually be raised to only support newer go versions, but until that decision is made, this needs to stay with using ioutils.

@BenTheElder
Copy link
Member

Right, importantly KIND is embeddable as a library for testing purposes, so we take great care in changing the requirements for library users (including adding more dependencies, bumping go version required, etc.)

It might be reasonable to start requiring go1.16, but we should actually do so by changing the go.mod go statement if we're going to. Go 1.16 came out February 2021 about a year after Go 1.14. While go only officially supports 1.19 and 1.20 currently, until very recently Kubernetes itself did not bump go versions on release branches so we could not drop version support as quickly as Go does upstream.

Does this improve anything immediately? Are there any bug fixes we're missing because we haven't moved?
Are these 100% compatible rewrites?

@yanggangtony
Copy link
Member Author

yanggangtony commented Apr 3, 2023

@stmcginnis @BenTheElder
Thanks very much for the quick review..

Yes , you are right .
Now the go.mod dependencie is go1.14 .
This pr will hold on until we support go's high version.
At that time , the go.mod and the new's dependencie will import and test careful.

@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Apr 8, 2023
Copy link
Member

@BenTheElder BenTheElder left a comment

Choose a reason for hiding this comment

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

I see at least one case that isn't clearly equivalent, otherwise I think this looks good and we can do this in the next kind release.

Let's update go.mod to 1.16

pkg/fs/fs.go Outdated
if err != nil {
return err
}
for _, entry := range entries {
entrySrc := filepath.Join(src, entry.Name())
entryDst := filepath.Join(dst, entry.Name())
if err := copy(entrySrc, entryDst, entry); err != nil {
fileInfo, _ := entry.Info()
Copy link
Member

Choose a reason for hiding this comment

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

we shouldn't discard this error?

Copy link
Member Author

Choose a reason for hiding this comment

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

entries, err := os.ReadDir(src)
In the above code , If the err is nil , Maybe deduction the entry.Info() will return normal code without err .

But you are right , we should consider the error side..
I will update it later...

yanggang added 2 commits April 19, 2023 04:51
Signed-off-by: yanggang <gang.yang@daocloud.io>
Signed-off-by: yanggang <gang.yang@daocloud.io>
@yanggangtony
Copy link
Member Author

Another commit to bump go.mod to 1.16..

@BenTheElder
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 20, 2023
@yanggangtony
Copy link
Member Author

/retest

@BenTheElder
Copy link
Member

Hmm that's a concerning timeout https://prow.k8s.io/view/gs/kubernetes-jenkins/pr-logs/pull/kubernetes-sigs_kind/3157/pull-kind-e2e-kubernetes-1-27/1649154486473592832

I don't think it's related to this PR but ... that's also not something I'd been seeing. It shouldn't take that long to build.

@stmcginnis
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 11, 2023
Copy link
Member

@BenTheElder BenTheElder left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve
thanks!

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: BenTheElder, yanggangtony

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 May 11, 2023
@k8s-ci-robot
Copy link
Contributor

@yanggangtony: 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
pull-kind-e2e-kubernetes-1-24 6749239 link unknown /test pull-kind-e2e-kubernetes-1-24

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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.

@BenTheElder BenTheElder merged commit df2a59f into kubernetes-sigs:main May 11, 2023
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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants