You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You will need to create a `.custom-gcl.yml` file to describe the custom linters you want to run. The following is an example of a `.custom-gcl.yml` file:
23
23
24
24
```yaml
25
-
version: v1.62.0
25
+
version: v1.64.8
26
26
name: golangci-kube-api-linter
27
27
destination: ./bin
28
28
plugins:
@@ -76,6 +76,33 @@ Where fixes are available within a rule, these can be applied automatically with
76
76
golangci-kube-api-linter run path/to/api/types --fix
77
77
```
78
78
79
+
### Golangci-lint Plugin
80
+
81
+
The Kube API Linter can also be used as a plugin for `golangci-lint`.
82
+
To do this, you will need to install the `golangci-lint` binary and then install the Kube API Linter plugin.
83
+
84
+
```shell
85
+
go build -buildmode=plugin -o bin/kube-api-linter.so sigs.k8s.io/kube-api-linter/pkg/plugin
86
+
```
87
+
88
+
This will create a `kube-api-linter.so` file in the `bin` directory.
89
+
90
+
The `golangci-lint` configuration is similar to the module configuration, however, you will need to specify the plugin path instead.
91
+
92
+
```yaml
93
+
linters-settings:
94
+
custom:
95
+
kubeapilinter:
96
+
path: "bin/kube-api-linter.so"
97
+
description: Kube API LInter lints Kube like APIs based on API conventions and best practices.
98
+
original-url: sigs.k8s.io/kube-api-linter
99
+
settings:
100
+
linters: {}
101
+
lintersConfig: {}
102
+
```
103
+
104
+
The rest of the configuration is the same as the module configuration, except the standard `golangci-lint` binary is invoked, rather than a custom binary.
105
+
79
106
#### VSCode integration
80
107
81
108
Since VSCode already integrates with `golangci-lint` via the [Go][vscode-go] extension, you can use the `golangci-kal` binary as a linter in VSCode.
0 commit comments