Skip to content

Enable kube-api-linter module in golangci-lint #675

@moko-poi

Description

@moko-poi

Enable kube-api-linter module in golangci-lint to enforce Kubernetes API conventions and best practices.

Motivation

The kube-api-linter is an official linter from kubernetes-sigs that checks Kubernetes API types for common mistakes and enforces best practices based on the Kubernetes API
Conventions
.

Currently, this project uses golangci-lint v2.4.0 but only has the default linters enabled (errcheck, govet, ineffassign, staticcheck, unused).

Proposed Changes

  1. Create .custom-gcl.yml to configure the kube-api-linter module:
version: v2.5.0
name: golangci-lint-kube-api-linter
destination: ./bin
plugins:
  - module: 'sigs.k8s.io/kube-api-linter'
    version: 'v0.0.0-20251029102002-9992248f8813'
  1. Create .golangci.yml to enable the linter:
linters-settings:
  custom:
    kubeapilinter:
      type: "module"
      description: "Kube API Linter lints Kube like APIs based on API conventions and best practices"

linters:
  enable:
    - kubeapilinter
  1. Update CI workflow if necessary

References

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions