Skip to content

Conversation

@thaJeztah
Copy link
Member

The os/ioutil package is now deprecated, so replace with os. While at it,
also replace its used for test.TempDir() in tests, which is easier to use
as it is automatically cleaned up.

The os/ioutil package is now deprecated, so replace with os. While at it,
also replace its used for test.TempDir() in tests, which is easier to use
as it is automatically cleaned up.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Comment on lines -45 to +42
fres := filepath.Join(tmpdir, tt)
require.FileExists(t, fres)
bres, err := ioutil.ReadFile(fres)
bres, err := os.ReadFile(filepath.Join(tmpdir, tt))
Copy link
Member Author

Choose a reason for hiding this comment

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

The require.FileExists() check felt a bit redundant here, as os.ReadFile() will already return an error if the file doesn't exist (which would also include the name of the missing file.

Copy link
Member

Choose a reason for hiding this comment

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

Yes indeed

@thaJeztah
Copy link
Member Author

@crazy-max ptal (found this one in my local fork 😂)

@crazy-max crazy-max merged commit f765001 into docker:main Feb 23, 2022
@thaJeztah thaJeztah deleted the replace_ioutil branch February 23, 2022 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants