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

replace deprecated ioutil package functions with latest advised io and os package replacements #39

Closed
mrutkows opened this issue Jun 20, 2023 · 10 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@mrutkows
Copy link
Contributor

With the advent of v1.19, we now have a mature replacement for all needed functions from the deprecated ioutil package (as of v1.16).

For example, the utility currently uses ioutil.ReadAll which would be replaced by io.ReadAll.

For a more complete set of package/function mappings see this answer: https://stackoverflow.com/questions/75206234/for-go-ioutil-readall-ioutil-readfile-ioutil-readdir-deprecated

@mrutkows mrutkows added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Jun 20, 2023
@mrutkows mrutkows changed the title replace deprecated ioutil package functions with latest advised 'io and os` package replacements replace deprecated ioutil package functions with latest advised io and os package replacements Jun 20, 2023
@ajistrying
Copy link
Contributor

Hello there! Is this project open to a golang newbie, if so I'd love to take this one as a first issue and continue to contribute as I learn more 🙂

@mrutkows
Copy link
Contributor Author

mrutkows commented Jun 22, 2023

@ajistrying I would welcome any help with the "good first issue" tag and offer time to help, discuss approaches (if not obvious) and provided review/comment on draft PRs.

Please know I have changed a couple of these as part of PR: #40 (which I plan to merge by EOD Monday), but have made no attempt at universally replacing all occurrences.

@ajistrying
Copy link
Contributor

ajistrying commented Jun 23, 2023

@mrutkows No worries and thank you! What I can do is start on the replacements and wait for that PR to get merged in to incorporate it 👍

@mrutkows
Copy link
Contributor Author

mrutkows commented Jun 27, 2023

It appears that these files/occurrences (may) still need refactoring:

$ grep -inr "ioutil" --include=*.go
./cmd/license_policy_config.go:23:	"io/ioutil"
./cmd/license_policy_config.go:176:	buffer, errRead := ioutil.ReadFile(config.policyConfigFile)
./schema/schema_custom_validation.go:23:	"io/ioutil"
./schema/schema_custom_validation.go:48:	buffer, err := ioutil.ReadFile(cfgFilename)
./schema/schema_formats.go:23:	"io/ioutil"
./schema/schema_formats.go:200:	buffer, err := ioutil.ReadFile(cfgFilename)
./schema/schema_formats.go:359:	sbom.rawBytes, errReadAll = ioutil.ReadAll(jsonFile)

@mrutkows
Copy link
Contributor Author

@ajistrying was wondering if you have time to do this work in the next day or so as I want to rush a release in order to support the latest CycloneDX v1.5 release which happened yesterday. If you are too busy, I may fix the remaining deprecated occurrences just to get them into this release. Sorry, to ask this of you.

@ajistrying
Copy link
Contributor

@mrutkows Yes I definitely can get this done by tomorrow. The start of this week has been pretty busy so apologies!

@mrutkows
Copy link
Contributor Author

@ajistrying Thanks. I will keep looking for your PR to be submitted and if it looks good create a release after merging it.

@ajistrying
Copy link
Contributor

Just signing off for work, will push up something in the next hour or so!

@ajistrying
Copy link
Contributor

@mrutkows #44 is up! Would love some insight on the automated comments from the sonatype-lift bot on the potential issues it highlighted.

@mrutkows
Copy link
Contributor Author

Fixed by: #44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants