-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
refactor: replace deprecated io/ioutil package #37467
base: main
Are you sure you want to change the base?
Conversation
io/ioutil package is deprecated Signed-off-by: blue-troy <12729455+blue-troy@users.noreply.github.com>
💚 CLA has been signed |
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
❕ Build Aborted
Expand to view the summary
Build stats
Steps errorsExpand to view the steps failures
|
Pinging @elastic/security-external-integrations (Team:Security-External Integrations) |
There is some lint issue right now, but not caused by this pr. |
@blue-troy thanks for the PR!
If the lint issues are not from your code, you can ignore them. |
/test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stack Monitoring modules LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be helpful for review to have a description of how the mutations here were performed. If it was done purely mechanically (hopefully it was), for example with a set of gofmt rewrites and a goimports cleanup, then the code used to make the changes can be included in the commit message to make use of git-generate
.
For most of the case is just replace ioutil package to other package. but ioutil.ReadDir replaced with os.ReadDir returns a different struct: before: contents, err := ioutil.ReadDir(src)
if err != nil {
return fmt.Errorf("failed to read dir %v: %w", src, err)
} after: contents := make([]fs.FileInfo, 0, len(contentEntries))
for _, entry := range contentEntries {
content, err := entry.Info()
if err != nil {
return fmt.Errorf("failed to stat %v: %w", entry.Name(), err)
}
contents = append(contents, content)
} this pr is not generate by script for some import package issue. |
@blue-troy Ideally, the mechanical and manual changes would be separate. I took a look at the break down of changes and the mechanical changes touch 195 files while the manual changes only alter 15. If they are separate greater care can be applied to the review of the manual changes. In cases where stdout and stderr are assigned |
This pull request is now in conflicts. Could you fix it? 🙏
|
1 similar comment
This pull request is now in conflicts. Could you fix it? 🙏
|
Pinging @elastic/security-service-integrations (Team:Security-Service Integrations) |
Setting back to draft until the conflict are fixed. |
io/ioutil package is deprecated
Proposed commit message
As of Go 1.16, the same functionality is now provided by package io or package os, and those implementations should be preferred. Successor functionality in io or os is more performant than the deprecated functionality in io/ioutil.
Checklist
I have made corresponding changes to the documentationI have made corresponding change to the default configuration filesI have added tests that prove my fix is effective or that my feature worksI have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.Related issues