Commit d715acf
committed
style: Document recent Go-pointer exceptions
The general rule seems to be:
If Go's default value has the same semantics we'd use for an unset
value, don't bother with a pointer.
I'm not sure how well that squares with [1]:
We want a consistent way to identify unset settings.
But if the falsy values count as "unset", maybe the "null is a
consistent identifier for unset" approach was never really viable.
Qiang points out that pointers are required to opt-out of boolean
settings where both true and false would require action [2], so I've
worded the exception to only apply when the Go default for the type is
expicitly a no-op in the spec.
I'm also not sure if the new style extends to integers where zero has
the same semantics as unset values. It sounds like Michael was ok
with no pointers for those values [3], but OOMScoreAdj (where zero
clearly means "do nothing") got a pointer in #233 [4]. More clarity
on the threshold would be nice; in this commit I've laid out the logic
and not explicitly listed the types it applies to.
[1]: #233 (comment)
[2]: https://github.com/opencontainers/specs/pull/317/files#r50932706
[3]: #233 (comment)
[4]: https://github.com/opencontainers/specs/pull/233/files#diff-34c30be66233f08b447fb608ea0e66bbR206
Signed-off-by: W. Trevor King <[email protected]>1 parent a7b5092 commit d715acf
1 file changed
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| 23 | + | |
| 24 | + | |
21 | 25 | | |
| 26 | + | |
0 commit comments