
operator-lint
Static analysis library for k8s operators created by operator-sdk
Usage
go install github.com/gibizer/operator-lint/
go vet -vettool=$(which operator-lint)
Checks
Check |
Category |
Added in |
Description |
T001 |
EnvTest |
v0.1.0 |
checks that Gomega's Eventually and Consistently blocks use a local Gomega instance for asserts |
--- |
--- |
--- |
--- |
C001 |
CRD |
v0.1.0 |
detects incompatible Required and Optional kubebuilder markers |
C002 |
CRD |
v0.1.0 |
detects incompatible Required kubebuilder marker and omitemty golang tag |
C003 |
CRD |
v0.2.2 |
detects incompatible defaulting via Optional kubebuilder marker and omitemty golang tag |
Flags
Command line flags can be used to configure each check in the form of:
go vet -vettool=$(which operator-lint) -<check name>.<flag>
Common flags supported by each check:
You can use go vet -vettool=$(which operator-lint) -flags
to print out all
the supported flags
Adding a new check
- Use
make new-lint
to generate a new empty linter under linters
.
- Update the README.md with the description of the check
- If the test data for the check has dependencies then
This whole dance is needed as the
analysistest package
does not support Go Modules currently.