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

golangci-lint issues #69

Closed
alok87 opened this issue Jul 28, 2022 · 3 comments
Closed

golangci-lint issues #69

alok87 opened this issue Jul 28, 2022 · 3 comments
Assignees

Comments

@alok87
Copy link

alok87 commented Jul 28, 2022

Issue1

go 1.18 support is not there in linter yet golangci/golangci-lint#2649, so these start failing https://github.com/thockin/go-build-template/blob/master/.github/workflows/lint.yaml#L39 if imports are of generic code

Issue2

Github action is using

- name: Lint
        uses: golangci/golangci-lint-action@v2

and the local make lint is using

require github.com/golangci/golangci-lint v1.47.2

It is failing as lint.sh needs the same parameters as github actions to show the same behaviour, fixed in my local by adding golangci.yaml and adding this to lint.sh: ERRS=$(golangci-lint run -v --max-same-issues 10 --disable-all --exclude-use-default=false "$@" 2>&1 || true)

I can push the fix if you are ok with it ^

@thockin
Copy link
Owner

thockin commented Jul 28, 2022

I don't follow - what is failing? As far as I can see, the GH Action for lint has passed?

Running with --disable-all means no linters run - why is that a solution?

$ ./build/lint.sh -v --disable-all --exclude-use-default=false ./...
Running golangci-lint: FAIL
level=info msg="[config_reader] Config search paths: [./ /home/thockin/src/go-build-template /home/thockin/src /home/thockin /home /]"
level=error msg="Running error: all linters were disabled, but no one linter was enabled: must enable at least one"
level=info msg="Memory: 2 samples, avg is 52.5MB, max is 52.5MB"
level=info msg="Execution took 3.802735ms"

@alok87
Copy link
Author

alok87 commented Jul 28, 2022

Adding -v was the cause of this failure. Just fixed my repo. I was making both GitHub action and lint sh similar by adding a .golangci.yaml which both uses.

Now we have two things make lint and then we run lint using GitHub action. Why not make lint in all places?

Need to keep both same and duplicate code now!

Really nice thing with the repo was u could run make task anywhere, with GitHub action that's not happening

@thockin
Copy link
Owner

thockin commented Jul 28, 2022 via email

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 a pull request may close this issue.

2 participants