-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Initial adoption of golangci-lint for continuous integration #278
Conversation
use strings.ReplaceAll method instead off strings.Replace (gocritic)
Should use `time.Since` instead of `time.Now().Sub`
Fixed running 'gofmt -s -w file'
len(matchTokens) <= 0 can be len(matchTokens) == 0
We passet huge parameters by pointer
Can re-write `<a href="([A-Za-z0-9\/.]+)"><b>` as `<a href="([A-Za-z0-9/.]+)"><b>`
@vzamanillo wow, this is amazing work! It'll take some more work to make things proper however this is a good start. |
Thank you very much @Ice3man543! as you said, it is a good start. |
@vzamanillo As it's a very big PR, give me some time to look over the changes. I'll work on this PR and merge this ASAP! |
Don't worry, we are not hurry, it is better to make sure nothing is broken before merge. Tell me if you need help with anything. |
We separate the logic to upload to chaos to preserve the SRP away from utils.
Build fails because we are running go get before running this action: fetched $GOPATH/pkg/mod conflict. Ref: golangci/golangci-lint-action#23
Can we merge this?, I have a lot of cool things on my mind but I am waiting to this PR has been released. Do you need help to review it? |
Hi @vzamanillo, Thank you for confirming and letting us know, this PR is ready for the review and merge, we will this merge this in a day or two, thanks a lot for putting all the work on this. |
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.
Awesome work! Thanks a lot for cleaning up the code!
Thanks! |
Implements #277
Needs revision, it should be set as a draft for further improvement before confirming the merge.
There are several linters that I have disabled because for now it is a lot of work to correct the errors, for example
funlen
: Detection of long functions.gocyclo
: Calculates cyclomatic complexities.gosec
: Inspects source code for security problems.lll
: Line length linter, used to enforce line length in files.and I have added some directives to skip the checks with (
nolint
) because they need a small refactor but I think it's fine for now, we can improve it in the future.Changes need in-depth review to make sure nothing is broken and that they are appropriate.
If you want to test this locally with https://github.com/nektos/act you'll have to add an additional step before
"Set up Go"
due to a dependencies error of thenektos/act
default docker image.Note I added a new step
golangci-lint
afterBuild
step instead of adding a new workflow file as https://github.com/golangci/golangci-lint-action#how-to-use recommends, but in the future we could move it to its own file to have better control over the actions of the GitHub workflow.I think the configuration is not very strict but it ensures a minimum quality of the code, if you consider it appropriate we can add other linters to make it more strict, but we have to think about it in order to facilitate the work of the collaborators in new pull requests.
We have an open discussion here.
I have do my best, I apologize in advance for any possible problems that may arise.