Skip to content

Commit 258b349

Browse files
committed
Introduce golangci-lint-convgen
1 parent 0aca923 commit 258b349

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,52 @@ configuration** and **comprehensive diagnostics** to
109109
}
110110
```
111111

112+
## Lint
113+
114+
Convgen provides a [golangci-lint](https://github.com/golangci/golangci-lint)
115+
plugin that validates Convgen directives during development inside your IDE.
116+
117+
It's not an official plugin, so you need to build it manually:
118+
119+
```bash
120+
make golangci-lint-convgen
121+
```
122+
123+
Then, add the following configuration to your `.golangci.yaml`. Because Convgen
124+
directives are only valid when the `convgen` build tag is set, make sure to
125+
include it under the `run.build-tags` section:
126+
127+
```yaml
128+
version: "2"
129+
130+
run:
131+
build-tags:
132+
- convgen
133+
134+
linters:
135+
settings:
136+
custom:
137+
convgen:
138+
type: module
139+
```
140+
141+
Now the `golangci-lint-convgen` binary can validate Convgen directives in your
142+
project. To make this process seamless in your IDE, you can configure it as the
143+
default linter. For Visual Studio Code, add the following to your settings:
144+
145+
```json
146+
{
147+
"go.lintTool": "golangci-lint-v2",
148+
"go.lintFlags": ["--build-tags=convgen"],
149+
"go.alternateTools": {
150+
"golangci-lint-v2": "/path/to/golangci-lint-convgen",
151+
}
152+
}
153+
```
154+
155+
With this setup, your Convgen directives will be validated in real time as you
156+
code.
157+
112158
## License
113159
114160
MIT License -- see [LICENSE](LICENSE) for details.

0 commit comments

Comments
 (0)