Replies: 4 comments 7 replies
-
Hello, I don't have the answer about VSCode but I'd like to discuss shareable configuration. The (remotely) shareable configuration seems to be a common problem, I started to reference all the issues and PRs about this because we have to be able to provide an "official" solution/answer. I've been having a look at your idea of using a Go module to embed a configuration file, and I've come across an issue. |
Beta Was this translation helpful? Give feedback.
-
One option might be to create a frontend program for golangci-lint that embeds the config. Not necessarily ideal, but could be good in a company environment with a lot of developers. |
Beta Was this translation helpful? Give feedback.
-
I haven't worked with golangci-lint enough to know if this can work, but want to provide an example from Rails that worked extremely well for Rubocop.
|
Beta Was this translation helpful? Give feedback.
-
Just for the context for those who may not be aware I'd like to add how this is managed in JS/TS world:
|
Beta Was this translation helpful? Give feedback.
-
At work, we have a shared golangci configuration that lives in a github repo,
github.com/github/go-linter
.I'm trying to figure out how best to share that configuration across many go repos. I've heard that other languages use their package managers to handle pinning a version of the linting config, and I thought that sounded like a good idea. I can get that to work, mostly.
In the go project, we add a
Which then pins a version of the go-linter code in our go.mod.
I can then call golangci-lint using the config file in that go-linter module by using this command from the terminal:
Cool. Now I can run that locally and in CI, and always use the same pinned version of the config file referenced by the project's go.mod file.
However, there doesn't immediately seem to be a way to get VSCode to use the same setting for it's lint-on-save functionality. You can't set this in your settings.json:
It doesn't work (and probably shouldn't.... I don't think we want our settings file to be able to run arbitrary bash commands).
But I'm not sure how to solve this conundrum - using the correct linter config in vscode is super important to avoid having to wait for CI to find linting errors.
Any suggestions would be welcome. Ideally, I'd like to use go modules to pin the config version, but I'd consider other solutions (aside from git submodules... I know someone is going to suggest it, and just... no).
Beta Was this translation helpful? Give feedback.
All reactions