A wrapper that automatically calls the golangci-lint version matching your project.
It traverses filesystem upwards until it finds the file .golangci-version
with the following format:
1.63.4
Good place to have the version file is your git repo root.
It installs the right golangci-lint version using the Binaries install method. Binaries are stored under ~
like this:
.vmatch
└── golangci-lint
└── v1.63.4
└── golangci-lint
I saw mismatching linter versions causing confusion in a team so I thought to automate it.
vmatch
does not manage Go versions. As the installed Go version affects golangci-lint output, the golangci-lint version matching is not as automated as it could be.
A solution to this could be to implement another wrapper for Go, vmatch -- go
. But this brings up another issue:
Currently, integrating vmatch
into for example VS Code should not end up in version control. But should vmatch -- go
be implemented, it would definitely be visible in tracked files with the current wrapping approach.
There are better ways to "replace" binaries, one way is for example to "use bash aliases or functions in your profile" as described [1], which further refers to [2]
The problem with said approach is, that it introduces additional complexity [managing shell aliases/functions], which is somewhat undesired. TBD
- Wrapper-specific cli (with --, and use an actual library)
- Include an actual test in the brew formula
- Also manage Go versions
- For now focus is on Apple Silicon macbooks but cross-platform is more or less required for more serious usage.
- Providing a Docker image might be worthwhile, similar to https://golangci-lint.run/welcome/install/#docker
- Simplify these docs, currently this is a collection of somewhat random thoughts.
Currently there's not too much code and the overall direction of the project is still quite open.
Once the project is defined feature-complete, writing automated tests (covering all platforms) would be essential for long-term maintenance.
Install with
brew install anttiharju/tap/vmatch
Instead of calling golangci-lint, call vmatch. And have a .golangci-version
file as outlined above.
For VS Code, this can be done with a .vscode/settings.json
file like the one below:
{
"go.lintTool": "golangci-lint",
"go.lintFlags": ["--fast"],
"go.alternateTools": {
"golangci-lint": "/opt/homebrew/bin/vmatch"
}
}
For more documentation on VS Code integration, refer to golangci-lint docs.