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
+65-6Lines changed: 65 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,12 +21,71 @@ 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
+
```
43
+
44
+
### Content
45
+
46
+
Where necessary, the values in the example can be empty or unset, but accommodate with comments regarding this intention.
47
+
48
+
Where feasible, the content and values used in an example should convey the fullest use of the data structures concerned.
49
+
Most commonly onlookers will intend to copy-and-paste a "working example".
50
+
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.
51
+
52
+
```markdown
53
+
### Example
54
+
```
55
+
```json
56
+
{
57
+
"foo": null,
58
+
"bar": ""
59
+
}
60
+
```
61
+
62
+
**vs.**
63
+
64
+
```markdown
65
+
### Example
66
+
67
+
Following is a fully populated example (not necessarily for copy/paste use)
0 commit comments