Skip to content

golangci.yml file not in the cwd will cause prompt to fail #772

Open
@tyanxie

Description

@tyanxie

In order to allow all the go projects in my computer to use the .golangci.yml file directly instead of rewriting it every time, I put the .golangci.yml file in the home directory, like ~/.golangci.yml.

In version V1, golangci-lint worked well, but when I updated to version V2, it did not work properly.

After investigation, I found that the cause of the problem was that the file path output by golangci-lint v2 was relative to the .golangci.yml file, not relative to the cwd.

in golangci-lint v1:

Image

in golangci-lint v2:

Image

It's looks like when matching the file path, if golangci-lint version is v2, then it needs to be matched relative to the directory where the .golangci.yml file is located, not cwd.

I have tried to fix it using this method, and it works well in both v1 and v2 versions. I will make a pull request later. Hope you can give suggestions or merge it when you are free!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions