thockin/go-build-template

golangci-lint issues

alok87 opened this issue · 3 comments

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 ^

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"

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