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: replace ioutil with os. [-] #147

Merged
merged 10 commits into from
Oct 10, 2024

Conversation

danriedl
Copy link
Contributor

@danriedl danriedl commented Oct 8, 2024

This PR updates the deprecated ioutil module .

@danriedl danriedl marked this pull request as ready for review October 8, 2024 10:57
Copy link
Owner

@Shpota Shpota left a comment

Choose a reason for hiding this comment

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

Hi @danriedl

Thank you for the contribution.

I have two comments:

  • There are other places in the codebase where ioutil.WriteFile() is used, could you please adjust them?
  • I think 1.16 is reasonable as a minimal supported version. Could you please update the golangci/golangci-lint to a newer version. This will fix the CI error.

Note: you can run CI on your forked version for testing.

@danriedl
Copy link
Contributor Author

Thanks for the review @Shpota . I did fix the other occurence in my fork and did a rebase.
Also im testing with golangci/golangci-lint:v1.61.0. Im gonna test from now on locally, with golangci and will get of the erros and warnings there are in the linting step:

level=warning msg="[config_reader] The configuration option `run.skip-dirs` is deprecated, please use `issues.exclude-dirs`."
level=warning msg="The linter 'golint' is deprecated (since v1.41.0) due to: The repository of the linter has been archived by the owner. Replaced by revive."
level=warning msg="The linter 'deadcode' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused."
level=warning msg="The linter 'structcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused."
level=warning msg="The linter 'interfacer' is deprecated (since v1.38.0) due to: The repository of the linter has been archived by the owner. "
level=warning msg="The linter 'maligned' is deprecated (since v1.38.0) due to: The repository of the linter has been archived by the owner. Replaced by govet 'fieldalignment'."
level=warning msg="The linter 'scopelint' is deprecated (since v1.39.0) due to: The repository of the linter has been deprecated by the owner. Replaced by exportloopref."
level=warning msg="The linter 'varcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused."
level=warning msg="The linter 'gomnd' is deprecated (since v1.58.0) due to: The linter has been renamed. Replaced by mnd."
level=error msg="[linters_context] deadcode: This linter is fully inactivated: it will not produce any reports."
level=error msg="[linters_context] golint: This linter is fully inactivated: it will not produce any reports."
level=error msg="[linters_context] interfacer: This linter is fully inactivated: it will not produce any reports."
level=error msg="[linters_context] maligned: This linter is fully inactivated: it will not produce any reports."
level=error msg="[linters_context] scopelint: This linter is fully inactivated: it will not produce any reports."
level=error msg="[linters_context] structcheck: This linter is fully inactivated: it will not produce any reports."
level=error msg="[linters_context] varcheck: This linter is fully inactivated: it will not produce any reports."
Error: codegen/codegen.go:25:13: wrapperFunc: use strings.ReplaceAll method in `strings.Replace(srcText, "project-name", g.projectName, -1)` (gocritic)
		srcText = strings.Replace(srcText, "project-name", g.projectName, -1)
		          ^
Error: codegen/codegen.go:[56](https://github.com/danriedl/goxygen/actions/runs/11268390016/job/31335064723?pr=1#step:7:57):9: G306: Expect WriteFile permissions to be 0600 or less (gosec)
	err := os.WriteFile(
		strings.Join(pathElements, separator),
		content,
		0644,
	)
Error: main.go:4:2: import 'github.com/shpota/goxygen/cli' is not allowed from list 'Main' (depguard)
	"github.com/shpota/goxygen/cli"
	^
Error: main.go:5:2: import 'github.com/shpota/goxygen/codegen' is not allowed from list 'Main' (depguard)
	"github.com/shpota/goxygen/codegen"
	^
Error: codegen/codegen.go:5:2: import 'github.com/shpota/goxygen/static' is not allowed from list 'Main' (depguard)
	"github.com/shpota/goxygen/static"
	^
Error: codegen/codegen.go:[59](https://github.com/danriedl/goxygen/actions/runs/11268390016/job/31335064723?pr=1#step:7:60):3: Magic number: 0644, in <argument> detected (gomnd)
		0644,
		^
Error: Process completed with exit code 1.

@danriedl danriedl force-pushed the feat/ioutil-deprecation branch from 19da140 to 90cc478 Compare October 10, 2024 07:47
@Shpota Shpota merged commit 385d270 into Shpota:main Oct 10, 2024
16 checks passed
@Shpota
Copy link
Owner

Shpota commented Oct 10, 2024

Thank you @danriedl. Merged.

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