Description
When I run golangci-lint from a directory which is not where the configuration file (e.g.: .golangci.yml
) exists, then the custom plugin path is resolved relative to the current working directory, and not to where the configuration file resides.
In my case the issue I'm facing is that the vim linter Ale doesn't know what is the root directory of the go module I'm working on, and runs the linter from the package directory with something like: cd $(dirname $file) && golangci-lint run .
I would like the relative paths from .golangci.yml
to be relative to the file itself, so that the resolving behaviour would be agnostic to the cwd.
In the example below, the plugin will (with latest master) be resolved as $(pwd)/.go/bin/foobar.so
. I think it should instead be resolved as ~/some-project/.go/.bin/foobar.so
, making this deterministic regardless of the current working directory:
# ~/some-project/.golangci.yml
linters-settings:
custom:
foobar:
path: .go/bin/foobar.so
It's also possible to address this issue without breaking the current behavior by taking inspiration from Jest's <rootDir>
which is being expanded when the configuration file is loaded. So we could do something like:
linters-settings:
custom:
foobar:
path: <rootDir>/.go/bin/foobar.so