Skip to content
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

chore: remove deprecated functions now that we're on Go 1.16+ #375

Merged
merged 5 commits into from
Mar 7, 2024

Conversation

benhoyt
Copy link
Contributor

@benhoyt benhoyt commented Feb 29, 2024

This replaces most deprecated functions with modern equivalents, now that we're using Go 1.16+:

  • Replace ioutil.Foo with respective functions in io and os (this is the vast majority of the changed lines).
  • Replace golang.org/x/crypto/ssh/terminal package with golang.org/x/term.
  • Avoid use of ResponseRecorder.HeaderMap and .Header()
  • Use signal.NotifyContext now that it exists, instead of rolling our own.

Look at the commits individually if you want to see these separated out.

For reference, I found these usages with simple search, as well as the following staticcheck command (note that there are still some left that I didn't think worth updating):

$ staticcheck -checks SA1019 ./...

The only instance that required an actual change was the use of
ioutil.ReadDir in api_files.go, which I changed to os.ReadDir, but that
now returns a []DirEntry, so minor changes were required. All the other
changes were straight search-n-replaces.
@benhoyt benhoyt changed the title chore: remove deprecated functions now that we're on Go 1.20 chore: remove deprecated functions now that we're on Go 1.16+ Feb 29, 2024
Copy link
Contributor

@flotter flotter left a comment

Choose a reason for hiding this comment

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

Looks good to me! We will follow on our side ... :)

@benhoyt benhoyt merged commit 2a91474 into canonical:master Mar 7, 2024
15 checks passed
@benhoyt benhoyt deleted the update-for-go1.20 branch March 7, 2024 22:47
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