Skip to content

Support golangci-linter - #257

Open
lcd1232 wants to merge 5 commits into
probonopd:masterfrom
lcd1232:linter
Open

lcd1232 wants to merge 5 commits into
probonopd:masterfrom
lcd1232:linter

Conversation

@lcd1232

@lcd1232 lcd1232 commented Jun 10, 2023

Copy link
Copy Markdown
  • Adds support golangci-linter in CI/CD and locally (pre-commit run --all-files)
  • Fixes some linter warnings (not all of them since I don't know how it should work)

@probonopd

Copy link
Copy Markdown
Owner

Thanks @lcd1232

Getting


Error: ../internal/helpers/appdir.go:157:16: undefined: errors.Join
Error: ../internal/helpers/appdir.go:177:16: undefined: errors.Join
note: module requires Go 1.20
Error: Process completed with exit code 2.

Do you know what is going on there?

@lcd1232

lcd1232 commented Jun 18, 2023

Copy link
Copy Markdown
Author

@probonopd it seems like you have go version lower than go1.20. Could you check what's your version using go version?

@probonopd

Copy link
Copy Markdown
Owner

Isn't this where you set it?

go-version: '^1.20.x'

uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: '^1.20.x'

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Since it's already required in go.mod

@probonopd

Copy link
Copy Markdown
Owner

Thank you very much.
Looks like it is working as intended now?

@CalebQ42 how do you like this?

@CalebQ42

Copy link
Copy Markdown
Contributor

Ultimately I think having a consistent linter strategy is a good thing, but I'm not sure golangci-linter is a good choice. It doesn't seem to provides any tangible benefits vs using a single linter. I personally have been using staticcheck since it's the default for VS Code and golangci-linter didn't seem to catch anything new in this project or any of my other projects. Additionally on golangci-linter's own website it says it includes staticcheck even though it's author is against it, which turns me off enough that I personally won't be using it in my personal projects.

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.

3 participants