Skip to content

Conversation

@thaJeztah
Copy link
Member

The package has been deprecated since Go 1.16: https://go.dev/doc/go1.16#ioutil

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]>
Copy link
Member

@crazy-max crazy-max left a 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.

@thaJeztah
Copy link
Member Author

We should also add a depguard rule for https://golang.org/pkg/syscall maybe:

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.

@thaJeztah
Copy link
Member Author

We should look at using t.TempDir() in tests though (also in buildkit). Not urgent (but it can be nice and clean in some cases) similar to docker/cli#3443

@thaJeztah thaJeztah requested a review from AkihiroSuda March 10, 2022 21:08
@tonistiigi tonistiigi merged commit 3adca1c into docker:master Mar 15, 2022
- gofmt
- govet
- deadcode
- depguard
Copy link
Member

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?

Copy link
Member Author

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

@thaJeztah thaJeztah deleted the replace_ioutil branch March 15, 2022 06:43
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.

3 participants