refactor: move from io/ioutil to io and os package#42792
refactor: move from io/ioutil to io and os package#42792thaJeztah merged 1 commit intomoby:masterfrom Juneezee:deprecate-ioutil
Conversation
The io/ioutil package has been deprecated in Go 1.16. This commit replaces the existing io/ioutil functions with their new definitions in io and os packages. Signed-off-by: Eng Zer Jun <[email protected]>
|
Thanks! |
|
This makes it impossible to build against Go 1.16 -- that's OK, but IMO we should either drop explicitly drop support for older Go (and actually commit to it, like dropping all those old build tags we ended up keeping) or revert this. 😬 |
|
@tianon it was already in go 1.16, but not yet in 1.15 |
|
I wouldn't be here if it worked in Go 1.16: 😅 ---> Making bundle: binary (in bundles/binary)
Building: bundles/binary-daemon/dockerd-dev
GOOS="" GOARCH="" GOARM=""
# github.com/docker/docker/pkg/plugins
pkg/plugins/discovery.go:44:12: undefined: fs.FileInfoToDirEntry |
|
Ah, ugh. devil is in the details there. That's a great way of recommending people to use the new location, and "oh by the way, it's not compatible"
They should've backported these bits to Go 1.16. Looking at our code, I see that's the only location it's used git grep FileInfoToDirEntry
pkg/plugins/discovery.go: entry = fs.FileInfoToDirEntry(fi)I think we can either revert the changes to that file, or copy the |
|
I did a quick PR for variant "or copy the |
- What I did
The
io/ioutilpackage has been deprecated in Go 1.16 (See https://golang.org/doc/go1.16#ioutil). This PR replaces the existingio/ioutilfunctions with their new definitions inioandospackages.- How I did it
Searches and replaces the deprecated functions with the new functions using VSCode
- How to verify it
All usage of
io/ioutilhas been replaced by the corresponding new definitions in theioandospackages. Searching forio/ioutilshould yield empty result.- Description for the changelog