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

GitHub Annotations suppresses normal output #362

Closed
4 tasks done
directionless opened this issue Oct 28, 2021 · 9 comments · Fixed by #769
Closed
4 tasks done

GitHub Annotations suppresses normal output #362

directionless opened this issue Oct 28, 2021 · 9 comments · Fixed by #769

Comments

@directionless
Copy link

Welcome

  • Yes, I'm using a binary release within 2 latest major releases. Only such installations are supported.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc).
  • Yes, I've tried with the standalone linter if available. (https://golangci-lint.run/usage/linters/)

Description of the problem

I really love that the github action supports annotations. But when using it, there is minimal other output. Specifically, while the message is printed, it lacks the file/line number. (And at least sometimes, Github itself doesn't display anything at all)

Everything is in the annotations, but those don't display properly in a couple of cases:

  1. Newly added linters may find things outside the PR. Those annotations are not displayed anywhere. (There's a note that they happened, but no link to a file and line number
  2. If there are a lot of failures, having a clear list would be helpful

I'm not sure if this is a bug or a feature request...

I'd suggest either a normal print along side the github actions print, or allowing multiple out-formats to be specified.

Version of golangci-lint

github actions
      - uses: actions/checkout@v2
      - name: golangci-lint
        uses: golangci/golangci-lint-action@v2
        with:
          version: v1.42

Configuration file

N/A

Go environment

GitHub Actions

Verbose output of running

No Output:


No Output

Minimal Output:


Minimal Output

None of those include file/line number

Code example or link to a public repository

https://github.com/kolide/launcher/runs/4039960409?check_suite_focus=true

@boring-cyborg
Copy link

boring-cyborg bot commented Oct 28, 2021

Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors.

@ldez ldez transferred this issue from golangci/golangci-lint Oct 28, 2021
@ldez ldez added the bug Something isn't working label Oct 28, 2021
@directionless
Copy link
Author

I think this is a limitation of how the underlying golangci-lint output options work

@directionless
Copy link
Author

Another possible solution is to ensure the annotation text itself contains the file and line number. For example, if I have an incorrect workflow file, I get:
incorrect workflow

@SVilgelm
Copy link
Member

I solved this issue by running the linter two times:

  1. GitHub action, it will install the linter and report the issues as annotations
  2. simple step with run: golangci-lint run, it will report all issues as normal output and it will use the cache from first step, pretty fast step

@SVilgelm SVilgelm removed the bug Something isn't working label Oct 29, 2021
@SVilgelm
Copy link
Member

@ldez this is not a bug, it is a limitation of the output format, probably we can allow to define multiple output formats

@directionless
Copy link
Author

My first thought had been multiple output formats, but on some reflection, just including the file/line number in the annotation maybe cleaner. Or both. I'm happy to try to put up a PR, though I don't know which of the 3 approaches is likely to be accepted.

@Emyrk
Copy link

Emyrk commented Apr 22, 2022

I would really like the file + line number context in both areas as well.

@ldez
Copy link
Member

ldez commented Apr 22, 2022

In golangci-lint it's now possible to have multiple output formats.
Maybe it requires some changes inside the GitHub Action.

@zfy0701
Copy link

zfy0701 commented Aug 10, 2022

the problem of running lint twice makes the github page show error twice as well, e.g.
image

but it still much better than no output. in some cases, not just line number but the detail error message will be eaten

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants