Skip to content

Commit

Permalink
API conventions: add note about when struct fields should be pointer
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Büringer [email protected]
  • Loading branch information
sbueringer committed Dec 3, 2021
1 parent 29c902c commit 91f64eb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,10 @@ This project follows the [Kubernetes API conventions](https://github.com/kuberne

Optional fields have the following properties:
* An optional field MUST be marked with `+optional` and include an `omitempty` JSON tag.
* Fields SHOULD be pointers if the nil and the zero values (by Go standards) have semantic differences.
* Note: This doesn't apply to map or slice types as they are assignable to `nil`.
* Fields SHOULD be pointers if there is a good reason for it, e.g:
* the nil and the zero values (by Go standards) have semantic differences.
* Note: This doesn't apply to map or slice types as they are assignable to `nil`.
* the field is of a struct type and would show up as an empty object after marshalling (e.g. `kubectl get`)

#### Example

Expand Down Expand Up @@ -439,4 +441,4 @@ As of today there are following OWNERS files/Owner groups defining sub areas:
- [Infrastructure Provider Docker (CAPD)](test/infrastructure/docker)
- [Test](test)
- [Test Framework](test/framework)
- [Docs](docs)
- [Docs](docs)

0 comments on commit 91f64eb

Please sign in to comment.