Skip to content

Struct fields should use omitzero when they are not a pointer #3945

@rikatz

Description

@rikatz

Followup of https://github.com/kubernetes-sigs/gateway-api/pull/3929/files#r2222627815

Per Joel's comment, the right approach is:

  • Structs that are not pointers should use omitzero
  • Structs that are pointers should use omitempty

This issue intends to fix the findings on our API, assuming that Go >= 1.24 is being used, so the marshalling/unmarshalling of these structs can happen correctly and as expected by the API conventions guideline

Metadata

Metadata

Assignees

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