Skip to content

Separate relative path mode for config vs output #5646

Closed
@nvx

Description

@nvx

Welcome

How did you install golangci-lint?

Official GitHub Action

Your feature request related to a problem? Please describe

Specifying a relative path mode of cfg is needed to reliably detect additional config files such as for ruleguard.

Unfortunately this then results in linter outputs using paths relative to the cfg directory too so they start with eg ../../../../../../ breaking CI workflows from referencing the right file

Describe the solution you'd like

A way to specify ruleguard configuration relative to the config directory but path outputs relative to either the working directory, gitroot, or go mod root would fix the issue.

Describe alternatives you've considered

This seemed to work fine under golangci-lint 1.x. Specifying gitroot as the relative-path-mode breaks loading ruleguard rules but output paths are fine, specifying cfg allows ruleguard rules to load fine but output paths are wrong.

Additional context

ruleguard config:

        ruleguard:
          failOn: all
          rules: ${base-path}/ruleguard/*.go

Supporter

Metadata

Metadata

Assignees

Labels

area: outputRelated to issue outputenhancementNew feature or improvement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions