You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: style.md
+65Lines changed: 65 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,70 @@ The redundancy reduction from removing the namespacing prefix is not useful enou
21
21
So we have a consistent way to identify unset values ([source][optional-pointer]).
22
22
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][no-pointer-for-slices], [here][no-pointer-for-boolean], and [here][pointer-when-updates-require-changes]).
23
23
24
+
## Examples
25
+
26
+
### Anchoring
27
+
28
+
For any given section that provides a notable example, it is ideal to have it denoted with [markdown headers][markdown-headers].
29
+
The level of header should be such that it is a subheader of the header it is an example of.
30
+
31
+
#### Example
32
+
33
+
```markdown
34
+
## Some Topic
35
+
36
+
### Some Subheader
37
+
38
+
#### Further Subheader
39
+
40
+
##### Example
41
+
42
+
To use Further Subheader, ...
43
+
44
+
### Example
45
+
46
+
To use Some Topic, ...
47
+
48
+
```
49
+
50
+
### Content
51
+
52
+
Where necessary, the values in the example can be empty or unset, but accommodate with comments regarding this intention.
53
+
54
+
Where feasible, the content and values used in an example should convey the fullest use of the data structures concerned.
55
+
Most commonly onlookers will intend to copy-and-paste a "working example".
56
+
If the intention of the example is to be a fully utilized example, rather than a copy-and-paste example, perhaps add a comment as such.
57
+
58
+
```markdown
59
+
### Example
60
+
```
61
+
```json
62
+
{
63
+
"foo": null,
64
+
"bar": ""
65
+
}
66
+
```
67
+
68
+
**vs.**
69
+
70
+
```markdown
71
+
### Example
72
+
73
+
Following is a fully populated example (not necessarily for copy/paste use)
74
+
```
75
+
```json
76
+
{
77
+
"foo": [
78
+
1,
79
+
2,
80
+
3
81
+
],
82
+
"bar": "waffles",
83
+
"bif": {
84
+
"baz": "potatoes"
85
+
}
86
+
}
87
+
```
24
88
25
89
[capabilities]: config-linux.md#capabilities
26
90
[class-id]: config-linux.md#network
@@ -30,3 +94,4 @@ The exceptions are entries where the Go default for the type is a no-op in the s
0 commit comments