pkg/plugins: fix compatibility with go1.16#42797
Merged
cpuguy83 merged 1 commit intomoby:masterfrom Aug 31, 2021
Merged
Conversation
Member
Author
|
@tianon @tonistiigi @cpuguy83 PTAL - let's discuss what direction we want to take. Alternatives:
|
2e7b43e to
32c5432
Compare
Member
Author
|
Ahum. of course it helps if you import the correct package 🤦 should be fixed now |
AkihiroSuda
approved these changes
Aug 28, 2021
tianon
reviewed
Aug 30, 2021
Member
tianon
left a comment
There was a problem hiding this comment.
I tested and this does successfully compile on Go 1.16 -- just a minor note/question/discussion about the new go1.16 file. 😇
commit c55a4ac changed the ioutil utilities to use the new os variants, per recommendation from the go 1.16 release notes: https://golang.org/doc/go1.16#ioutil > we encourage new code to use the new definitions in the io and os packages. > Here is a list of the new locations of the names exported by io/ioutil: However, the devil is in the detail, and io.ReadDir() is not a direct replacement for ioutil.ReadDir(); > ReadDir => os.ReadDir (note: returns a slice of os.DirEntry rather than a slice of fs.FileInfo) go1.16 added a io.FileInfoToDirEntry() utility to concert a DirEntry to a FileInfo, but it's not available in go1.16 This patch copies the FileInfoToDirEntry code, and uses it for go1.16. Signed-off-by: Sebastiaan van Stijn <[email protected]>
32c5432 to
303ea8e
Compare
Member
Author
|
@tianon I added a comment describing where we copied the code from (and why); PTAL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
relates to #42792 (comment)
commit c55a4ac (#42792) changed the ioutil utilities
to use the new os variants, per recommendation from the go 1.16 release notes:
https://golang.org/doc/go1.16#ioutil
However, the devil is in the detail, and io.ReadDir() is not a direct
replacement for ioutil.ReadDir();
go1.17 added a io.FileInfoToDirEntry() utility to concert a DirEntry to
a FileInfo, but it's not available in go1.16
This patch copies the FileInfoToDirEntry code, and uses it for go1.16.
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)