Skip to content

lint: update to golangci-lint/v2 #3710

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bhcleek
Copy link
Collaborator

@bhcleek bhcleek commented Apr 6, 2025

Fixes #3707

@bhcleek bhcleek added this to the vim-go v1.29 milestone Apr 6, 2025
@bernot-dev
Copy link

This does not address the 4th item from #3707. This now jumps to the incorrect path when action items are found.

@bhcleek
Copy link
Collaborator Author

bhcleek commented Apr 9, 2025

And how should one know where that root is? There's nothing in the output that tells you.

https://golangci-lint.run/product/migration-guide/ says there's a configuration value ,run.relative-path-mode, but there doesn't seem to be an option that exposes it at the command line.

There's a --path-prefix option, but I don't see a way to leverage it without a pre-flight call to the CLI before the golangci-lint call.

The only way I can see to handle this is to either pre-flight every golangci-lint run with a golangci-lint config path command to figure out what to pass to --path-prefix or to expect vim-go users to set run.relative-path-mode to wd.

Do you see other options?

@bhcleek
Copy link
Collaborator Author

bhcleek commented Apr 10, 2025

Pre-flighting will come with its own problems, too, because there's no way to check at the value of run.relative-path-mode, so it's hard to know how to interpret a relative path.

golangci-lint, IIRC, used to vary the paths in the response depending on the arguments it was given. I don't remember for sure, but it was something like, "if given an absolute path, return absolute paths". That's clearly not the case anymore.

After considering all of this, I don't see a good path forward short of expecting vim-go users to make sure run.relative-path-mode is set to wd, but I'm open to ideas.

@bhcleek
Copy link
Collaborator Author

bhcleek commented Apr 10, 2025

Looks like a solution has landed in golangci/golangci-lint#5651

@bernot-dev
Copy link

Nice! Looks like absolute paths will be available in 2.0.3, whenever that release is cut. My suggestions were going to be much hackier.

I wonder if there's a need to support v1/v2 co-existing. Personally, I think it's probably okay to just move to v2. I suspect it will raise an error if there's a v1 config that hasn't been migrated yet. Go only supports two previous versions (~1 year), and golangci-lint follows the language closely. So, golangci-lint@v1 should be largely irrelevant in about a year for actively maintained software.

That said, there could be a little bit of friction involved in the transition, which is worth acknowledging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Golangci-lint @ v2
2 participants