containerd/vendor/github.com/opencontainers/specs/style.md
Marcos Lilljedahl d5742209d3 Switch to new vendor directory layout
Fixes #113

Signed-off-by: Marcos Lilljedahl <marcosnils@gmail.com>
2016-03-16 01:56:22 -03:00

1.6 KiB

Style and conventions

Traditionally hex settings should use JSON integers, not JSON strings

For example, "classID": 1048577 instead of "classID": "0x100001". The config JSON isn't enough of a UI to be worth jumping through string <-> integer hoops to support an 0x… form (source).

Constant names should keep redundant prefixes

For example, CAP_KILL instead of KILL in linux.capabilities). The redundancy reduction from removing the namespacing prefix is not useful enough to be worth trimming the upstream identifier (source).

Optional settings should have pointer Go types

So we have a consistent way to identify unset values (source). The exceptions are entries where the Go default for the type is a no-op in the spec, in which case omitempty is sufficient and no pointer is needed (sources here, here, and here).