Skip to content

New Linter: dependenttags #146

@yongruilin

Description

@yongruilin

Create a new, configurable linter named dependenttags to enforce dependencies between markers. This prevents API inconsistencies where one marker requires the presence of
another.

Problem

There is currently no way to enforce that certain markers must be used together. For example, a field marked with +k8s:unionMember must also be marked +k8s:optional.

Solution

The linter will be configured with a main tag and a list of required dependent tags. If the main tag is present on a field, the linter will ensure at all the dependent tags are present.

Example

This would be invalid:

  // +k8s:unionMember
  MyField string

This would be valid:

  // +k8s:unionMember
  // +k8s:optional
  MyField string

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions