Description
I have a project that supports multiple languages, and all of the go code is in a well-behaved subdirectory:
.
├── frontend
├── proto
├── secrets
└── gocode
├── go.mod
├── go.sum
└── cmd
└── server
└── main.go
I configured the golangci-lint-action
as such:
jobs:
lint:
name: "Lint"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Runs a set of commands using the runners shell
- name: Lint
uses: golangci/golangci-lint-action@v1
with:
version: v1.26
working-directory: gocode
I am using the default .golangci.yml
configuration file. I tested a change that should fail the linter and I get the error correctly in the GitHub actions format:
##[error]func `unused` is unused (unused)
However, the error doesn't show up as an annotation on the pull request. Upon further investigation, it seems like the real out (from running locally) is this:
~/Projects/shepherd/gocode
.venv ❯ ~/go/bin/golangci-lint run --out-format github-actions
::error file=cmd/server/main.go,line=5,col=6::`unused` is unused (deadcode)
The problem appears to be that the file is outputted relative to the working directory and not the root of the GitHub repository (i.e. the path should be gocode/cmd/server/main.go
) which seems to be preventing GitHub from correctly handling this.
This appear to be a bug. Can this be fixed with an option of some kind? Or is there an existing option that handles this case?