-
-
Notifications
You must be signed in to change notification settings - Fork 45
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
ci: add golangci-lint #116
Conversation
00d1a57
to
4572090
Compare
4572090
to
56915b9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good ideas !
I suggest to look at the Makefile and
- directly use
make ci-full
command so we have the same checks locally and in the CI - Copy the Makefile steps in the CI. It would create 2 different ways to check things (inconsistent) but is probably better for performance and we would be able to have the tests decompositionore clearly.
What do you think about it ?
@@ -5,7 +5,6 @@ name: Go | |||
|
|||
on: | |||
push: | |||
branches: ["main"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep this one, I want to make sure main is OK at any moment!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same behavior as before.
see: https://github.com/commander-cli/cmd/blob/main/.github/workflows/lint.yaml#L3 for a reference. We can keep it explicit if you want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Looks like the makefile could use some work here as well. So a little look here. steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v4 Or steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
- run: make golangci-lint My two cents is we decompose with actions and we use the makefile for local testing. Yes, syncing the two will be a burden, but we can mitigate that by using these tools file based config when possible. To me CI is the real truth local ci is optional. I personally use make to automate local tasks and prefer making the ci as concise as possible using the ci tools native commands. I think I'm gonna go with using native github actions unless you strongly object. I'll create another PR with some work the Edit: turns on golang-ci lint simplifies this greatly. I will try to provide make targets that will compliment fixing issues that golangci-lint catches. |
Too add for tools that use the native go toolchain. I will more than likely elect to still use the make commands. And I'll get something using golangci-lint starting next week and honestly. I don't think we'd have a large syncing issue if we move everything to golangci-lint anyway. |
33feb87
to
a148aca
Compare
a148aca
to
a96dd1a
Compare
Okay. I think I landed on something that works well. I chose to leverage golangci-lint heavily. If we find it too slow in the future. (I mean we're under a minute now so probably not). We can decompose the commands to individual jobs. If this looks good I'll fix the few issues. Note: I elected to raise the gofumpt check to have -extra. I think moving forward we should focus on linting through golangci-lint and providing targets in the Makefile to auto resolve them. Another developer tool we can add the ability to opt in to pre-commit hooks for common mistakes, but that is out of the scope of the goal here. Also I will be editing the PR title to reflect this change. |
@@ -5,7 +5,6 @@ name: Go | |||
|
|||
on: | |||
push: | |||
branches: ["main"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking through the golangci-lint issues. It seems we only have two options to deal with the "unescaped html". Well 3 maybe 4
|
Right now: There are 100 options for markdown. Fuego provide one basic method for ease of use / rapid prototyping. Let's just ignore by commenting the warning, and warn the user that it might be a dangerous method in the docs. The user will create its own custom markdown parser if needed anyway. For the future (I could do this work in a separate PR): Cf Fuego Extra #118 |
Thank you for all this, this is a really important PR, good job 👍🏼 |
@EwenQuim I believe this is officially done. |
Any interest in adding staticcheck here?I've been adding linters to most my repos today and thought I'd hit this one.I'll fix the staticcheck issues once I hear back.Have a good weekend. Feel free to close if there isn't any interest.
After discussion this PR ended up adding golangci-lint rather than staticcheck