You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem?/Why is this needed
This project uses the ioutil package for the following functions
ReadAll
TempDir
ReadFile
WriteFile
ReadDir
The functions in ioutil have been deprecated in favour of similar functions in io and os. While some of these deprecated functions internally call the corresponding, recommended, io and os functions, we could benefit by replacing these usages directly in the project code.
Describe the solution you'd like in detail
Replace usages of deprecated functions on a case-by-case basis with functions in os and io. The following command finds all files in the utils project importing the ioutils package:
A simple MR replacing usages in these files with relevant (perhaps improved?) tests would be the solution. Almost all of the functions listed in the previous section have become wrappers around the newer functions. However, ioutil.ReadDir's replacement os.ReadDir offers supposedly better efficiency and the return type changes from fs.FileInfo -> fs.DirEntry and it returns a partial result in the case of an error while reading the directory. These changes do not matter in the context of this project and a simple replacement will work with no additional changes.
I've created a branch for this fix in my fork and go test ./... reports no errors
? k8s.io/utils/clock [no test files]
ok k8s.io/utils/buffer 0.366s
ok k8s.io/utils/clock/testing 0.657s
? k8s.io/utils/inotify [no test files]
? k8s.io/utils/internal/third_party/forked/golang/golang-lru [no test files]
ok k8s.io/utils/cpuset 0.934s
ok k8s.io/utils/diff 1.485s
ok k8s.io/utils/env 1.206s
? k8s.io/utils/nsenter [no test files]
ok k8s.io/utils/exec 4.072s
ok k8s.io/utils/exec/testing 1.685s
ok k8s.io/utils/field 1.661s
ok k8s.io/utils/integer 1.915s
ok k8s.io/utils/internal/third_party/forked/golang/net 2.192s
ok k8s.io/utils/io 2.250s
ok k8s.io/utils/keymutex 6.247s
ok k8s.io/utils/lru 7.261s
ok k8s.io/utils/mount 2.274s
ok k8s.io/utils/net 2.153s
ok k8s.io/utils/net/ebtables 2.368s
ok k8s.io/utils/path 2.328s
ok k8s.io/utils/pointer 2.272s
ok k8s.io/utils/ptr 1.672s
ok k8s.io/utils/semantic 1.706s
ok k8s.io/utils/set 1.696s
ok k8s.io/utils/strings 1.680s
ok k8s.io/utils/strings/slices 1.561s
ok k8s.io/utils/temp 1.647s
ok k8s.io/utils/temp/temptest 1.545s
ok k8s.io/utils/third_party/forked/golang/reflect 1.582s
ok k8s.io/utils/trace 1.598s
If this issue gets triaged, I can create a pull request.
Describe alternatives you've considered
N/A
Additional context
N/A
The text was updated successfully, but these errors were encountered:
k8s-ci-robot
added
lifecycle/rotten
Denotes an issue or PR that has aged beyond stale and will be auto-closed.
and removed
lifecycle/stale
Denotes an issue or PR has remained open with no activity and has become stale.
labels
Apr 21, 2024
Is your feature request related to a problem?/Why is this needed
This project uses the
ioutil
package for the following functionsThe functions in ioutil have been deprecated in favour of similar functions in io and os. While some of these deprecated functions internally call the corresponding, recommended,
io
andos
functions, we could benefit by replacing these usages directly in the project code.Describe the solution you'd like in detail
Replace usages of deprecated functions on a case-by-case basis with functions in
os
andio
. The following command finds all files in theutils
project importing theioutils
package:grep -Rl "io/ioutil" .
and the result is
A simple MR replacing usages in these files with relevant (perhaps improved?) tests would be the solution. Almost all of the functions listed in the previous section have become wrappers around the newer functions. However,
ioutil.ReadDir
's replacementos.ReadDir
offers supposedly better efficiency and the return type changes fromfs.FileInfo
->fs.DirEntry
and it returns a partial result in the case of an error while reading the directory. These changes do not matter in the context of this project and a simple replacement will work with no additional changes.I've created a branch for this fix in my fork and
go test ./...
reports no errorsIf this issue gets triaged, I can create a pull request.
Describe alternatives you've considered
N/A
Additional context
N/A
The text was updated successfully, but these errors were encountered: