Skip to content

The linter does not print line number nor filename #751

Closed
@jirihnidek

Description

@jirihnidek

Welcome

  • Yes, I understand that the GitHub action repository is not the repository of golangci-lint itself.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc).

Description of the problem

The linter only print message of the error (e.g.: "Error: ineffectual assignment to err (ineffassign)")

As you can see here: https://github.com/RedHatInsights/yggdrasil/actions/runs/5012437362/jobs/8984386684?pr=124

It is really hard to find reason of such issue, because there is lot of variables names err. This github action also did not create any annotation in the related PR. Maybe this is the reason. When the annotation was not possible to create, then the output of the linter to stdout should still be useful.

I had to install the golangci-lint locally, and then I was able to see and fix the issue.

Version of golangci-lint

3.3.0

Version of the GitHub Action

Current

Workflow file

name: Lint

on: pull_request

jobs:
  lint-commits:
    name: Lint commits
    runs-on: ubuntu-latest
    steps:
      - name: Check out code
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
          ref: ${{ github.event.pull_request.head.sha }}
      - uses: actions/cache@v3
        with:
          path: ~/go/pkg/mod
          key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
          restore-keys: |
            ${{ runner.os }}-go-
      - run: go mod download
      - name: Run commitsar
        uses: aevea/[email protected]
  lint-code:
    name: Lint code
    runs-on: ubuntu-latest
    steps:
      - name: Set up go
        uses: actions/setup-go@v3
        with:
          go-version: "1.19"
      - name: Check out code
        uses: actions/checkout@v3
      - name: Run golangci-lint
        uses: golangci/[email protected]
        with:
          version: "latest"
          args: "--verbose"
  lint-language:
    name: Lint language
    runs-on: ubuntu-latest
    steps:
      - name: Check out code
        uses: actions/checkout@v3
      - name: Run woke
        uses: get-woke/woke-action@v0
        with:
          fail-on-error: true

Go version

1.19

Code example or link to a public repository

https://github.com/RedHatInsights/yggdrasil/actions/runs/5012437362/jobs/8984386684?pr=124

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions