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

refactor: move from io/ioutil to io and os packages #1334

Merged
merged 1 commit into from
Sep 27, 2022
Merged

refactor: move from io/ioutil to io and os packages #1334

merged 1 commit into from
Sep 27, 2022

Conversation

Juneezee
Copy link
Contributor

Describe the PR
The io/ioutil package has been deprecated in Go 1.16 (See https://pkg.go.dev/io/ioutil). Since we have dropped support for Go 1.15 and lower (#1331), we can replace the existing io/ioutil functions with their new definitions in io and os packages.

  • ioutil.Discard => io.Discard
  • ioutil.NopCloser => io.NopCloser
  • ioutil.ReadAll => io.ReadAll
  • ioutil.ReadDir => os.ReadDir (returns a slice of os.DirEntry rather than a slice of fs.FileInfo, this may improve performance in some cases as os.ReadDir is more efficient [1])
  • ioutil.ReadFile => os.ReadFile
  • ioutil.TempDir => os.MkdirTemp
  • ioutil.TempFile => os.CreateTemp
  • ioutil.WriteFile => os.WriteFile

Relation issue

Additional context
Add any other context about the problem here.

The io/ioutil package has been deprecated as of Go 1.16 [1]. This commit
replaces the existing io/ioutil functions with their new definitions in
io and os packages.

[1]: https://golang.org/doc/go1.16#ioutil
Signed-off-by: Eng Zer Jun <[email protected]>
@codecov
Copy link

codecov bot commented Sep 27, 2022

Codecov Report

Base: 95.64% // Head: 95.64% // No change to project coverage 👍

Coverage data is based on head (13ef0e6) compared to base (74e96c9).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1334   +/-   ##
=======================================
  Coverage   95.64%   95.64%           
=======================================
  Files          14       14           
  Lines        2871     2871           
=======================================
  Hits         2746     2746           
  Misses         70       70           
  Partials       55       55           
Impacted Files Coverage Δ
format/format.go 92.30% <100.00%> (ø)
operation.go 96.24% <100.00%> (ø)
parser.go 93.88% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@ubogdan ubogdan left a comment

Choose a reason for hiding this comment

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

LGTM

@ubogdan ubogdan merged commit 075c176 into swaggo:master Sep 27, 2022
@ubogdan
Copy link
Contributor

ubogdan commented Sep 27, 2022

@Juneezee Thanks for your contribution.

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