-
-
Notifications
You must be signed in to change notification settings - Fork 152
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 action log output doesn't print the affected file name & line #119
Comments
Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors. |
The above run seems not available now. I have created one dummy run to check here. The output is as per expectation. run golangci-lint
Running [/home/runner/golangci-lint-1.31.0-linux-amd64/golangci-lint run --out-format=github-actions] in [] ...
Error: File is not `gofmt`-ed with `-s` (gofmt)
Error: File is not `goimports`-ed with -local github.com/golangci/golangci-lint (goimports)
Error: issues found
Ran golangci-lint in 58975ms Underlying golangci-lint-action is using github annotations for more user friendly, so where the error is shown (e.g. Files Changes, etc) is up to github annotation, but not golangci-lint. Related to #5. I am closing this issue. Feel free to re-open if there is anything else that I could have missed. |
I guess to clarify I was just hoping the file names would be displayed inline with the ie. I marked the location in the logs with
|
@dprotaso Thanks for your clarification. As golangci-lint is showing file name + line number, I transfered this issue to golangci-lint-action repo.
|
Can somebody confirm that it is on our side and it is technically possible to adjust the way how github annotations are represented in logs? AFAIK annotation format already contains file name + line number, but github is not showing this info in logs for some reason. I've tried to investigate this problem, but I can't find complete documentation for github annotations and how to manipulate them, so I'll be grateful for any help. |
Because file name and line number is written in I confirmed that. on:
push
jobs:
test:
runs-on: ubuntu-20.04
steps:
# `golangci-lint --output-format=github-actions` error message line format
- run: echo '::error file=path/to/source.go,line=367,col=16::error message (lint tool name)'
# improve format to output line number and file name to github actions log
- run: echo '::error file=path/to/source.go,line=367,col=16::path/to/source.go:367:16:error message (lint tool name)' link |
Great, so fix should be trivial? Upd: oh, seems like we can only fix that via duplicating link to file |
yes. https://github.com/actions/toolkit/blob/main/docs/problem-matchers.md |
Is there any news about this? i am currently trying to implement this in a github repo and not seeing which file and line an error belongs to in a direct way (having to check the full text based logs) is pretty annoying. |
Kindly ping. I have this issue too - annotation links are not working. |
Sure would be nice to see the affected filenames in the output on the GitHub website. It's not even visible when I click "View raw logs". But I can repro the results by running golangci locally:
... and see the filenames that way. Not great, but that unblocks me 👍 |
I changed the
Now, once I can test that the output format will work in general instead of just on the |
I believe that showing file/line info in build log is absolutely a must. In cases when already existing project adds golangci-lint-action (microsoft/hcsshim#975 as an example), none of reported errors are in diff. Instead, they are in files that already exist. The same will happen for repos that update to a newer version of golangci-lint. |
As well as if one to run the linter as a workflow_dispatch against a certain branch (not as a pull request run), then annotations are useless, as there are no files to browse to check them. So having line numbers in the action run log is very much awaited |
There are a few things to unpack here: The action specifically states that it is designed to be run in a That being said: While not "officially" supported (in-fact, the code attempts to prevent it, but seems to be bugged at the moment), I believe you can get the results you are looking for by setting
If you still want the annotation feature on |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
After the patch golangci-lint prints a file and a line number [1]. 1. golangci/golangci-lint-action#119 Closes #231
After the patch golangci-lint prints a file and a line number [1]. 1. golangci/golangci-lint-action#119 Closes #231
The patch adds a second golangci-lint run that prints errors in human-readable format [1]. 1. golangci/golangci-lint-action#119 Closes #231
The patch adds a second golangci-lint run that prints errors in human-readable format [1]. 1. golangci/golangci-lint-action#119 Closes #231
With the new version of the action (v3.6.0) you can now provide extra args to add extra output format. Example: - name: Golangci Lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.53.2
args: --out-format=colored-line-number https://golangci-lint.run/usage/configuration/#output-configuration Related to #769 |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as outdated.
This comment was marked as outdated.
This PR solves few issues: - uses newer version of the actions - triggers on changes on the ci file - add better args for the linting : golangci/golangci-lint-action#119 (comment) - runs golang tests
The problem will be fixed with golangci-lint v1.58: the file information (path, position) will be displayed. |
I added a new option I added this option for several reasons:
If you set |
Please include the following information:
Version of golangci-lint
Config file
Go environment
Verbose output of running
https://github.com/knative/networking/pull/233/checks?check_run_id=1275974348
I had to view the 'files changed' page to see the lints
The text was updated successfully, but these errors were encountered: