Description
I am using ruleguard
via the gocritic
linter. As part of using this linter, you must set the path to your rules:
golangci-lint/.golangci.example.yml
Lines 178 to 180 in 750309d
Unfortunately, if you currently set a relative path, it will be relative to the directory that you run golangci-lint
from. This means that you must always run golangci-lint
from the same directory or use an absolute path, which may not work across different environments.
#1572 dealt with a similar issue for custom plugins. It fixed the issue by adding an explicit check to see if the path was relative or absolute.
I looked into doing this for the ruleguard
settings, but it appears that the settings code is very generic and doesn't know anything in particular. Would a PR that added a special case to that code for ruleguard
be accepted? I would understand if it would be considered in bad taste.
A more general alternative might be if golangci-criitc
changed the working directory to the configuration dir directory before running the linters. However, I suspect this would cause other problems.