-
Notifications
You must be signed in to change notification settings - Fork 617
Remove uses of deprecated io/ioutil #995
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
Conversation
The package has been deprecated since Go 1.16: https://go.dev/doc/go1.16#ioutil Signed-off-by: Sebastiaan van Stijn <[email protected]>
The package has been deprecated since Go 1.16: https://go.dev/doc/go1.16#ioutil Signed-off-by: Sebastiaan van Stijn <[email protected]>
crazy-max
left a comment
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.
LGTM, thanks!
We should also add a depguard rule for https://golang.org/pkg/syscall maybe:
Deprecated: this package is locked down. Callers should use the corresponding package in the golang.org/x/sys repository instead. That is also where updates required by new systems or versions should be applied. See https://golang.org/s/go1.4-syscall for more information.
That one is more tricky; the syscall packages has some "platform agnostic" implementations that do not live elsewhere (unless you create separate win/mac/linux variants etc. It's ok to use those alternatives for most cases, but I've seen a couple where it was either complicated, or where you didn't want to use the extra dependency of golang.org/x/sys. |
|
We should look at using |
| - gofmt | ||
| - govet | ||
| - deadcode | ||
| - depguard |
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.
why isn't there a linter that just checks for deprecated functions in stdlib?
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.
Because ... "do as we say, not as we do" (?) they didn't deprecated it in code; https://github.com/golang/go/blob/go1.16.15/src/io/ioutil/ioutil.go#L25-L26
Otherwise staticcheck would've picked it up (e.g. like for strings.Title() (which IMO shouldn't have been marked deprecated, just had its limitations better documented); see moby/moby#43201
The package has been deprecated since Go 1.16: https://go.dev/doc/go1.16#ioutil