Skip to content

Commit ec427f9

Browse files
committed
cmd/cue: fix up get go docs around "enum" types
A legacy of pre-# definitions. Change-Id: Ie341b5884672562bd525b64081faa40c5c379945 Reviewed-on: https://cue-review.googlesource.com/c/cue/+/9901 Reviewed-by: CUE cueckoo <[email protected]> Reviewed-by: Marcel van Lohuizen <[email protected]>
1 parent 8e053d4 commit ec427f9

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

cmd/cue/cmd/get_go.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ For instance, for the type
133133
134134
package foo
135135
136-
type IP4String string
136+
type IP4String string
137137
138138
defined in the Go package, one could add a cue file foo.cue with the following
139139
contents to allow IP4String to assume only valid IP4 addresses:
@@ -180,29 +180,29 @@ translates into the following CUE definitions:
180180
181181
package foo
182182
183-
#Switch: int // enumSwitch
183+
#Switch: int // #enumSwitch
184184
185-
enumSwitch: Off | On
185+
#enumSwitch: Off | On
186186
187187
Off: 0
188188
On: 1
189189
190-
This definition allows any integer value for Switch, while the enumSwitch value
191-
defines all defined constants for Switch and thus all valid values if Switch
192-
were to be interpreted as an enum type. To turn Switch into an enum,
190+
This definition allows any integer value for #Switch, while the #enumSwitch
191+
value defines all defined constants for Switch and thus all valid values if
192+
#Switch were to be interpreted as an enum type. To turn #Switch into an enum,
193193
include the following constraint in, say, enum.cue, in either the original
194194
source directory or the generated directory:
195195
196196
package foo
197197
198198
// limit the valid values for Switch to those existing as constants with
199199
// the same type.
200-
#Switch: enumSwitch
200+
#Switch: #enumSwitch
201201
202-
This tells CUE that only the values enumerated by enumSwitch are valid
203-
values for Switch. Note that there are now two definitions of Switch.
204-
CUE handles this in the usual way by unifying the two definitions, in which case
205-
the more restrictive enum interpretation of Switch remains.
202+
This tells CUE that only the values enumerated by #enumSwitch are valid values
203+
for #Switch. Note that there are now two definitions of #Switch. CUE handles
204+
this in the usual way by unifying the two definitions, in which case the more
205+
restrictive enum interpretation of #Switch remains.
206206
`,
207207
// - TODO: interpret cuego's struct tags and annotations.
208208

0 commit comments

Comments
 (0)