Shpota / goxygen

Generate a modern Web project with Go and Angular, React, or Vue in seconds 🎲
https://goxygen.dev
Apache License 2.0
3.53k stars 219 forks source link

chore: replace ioutil with os. [-] #147

Closed danriedl closed 1 month ago

danriedl commented 1 month ago

This PR updates the deprecated ioutil module .

danriedl commented 1 month ago

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.
Shpota commented 1 month ago

Thank you @danriedl. Merged.