this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <cueckoo@gmail.com>
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>

+11 -11
+11 -11
cmd/cue/cmd/get_go.go
··· 133 133 134 134 package foo 135 135 136 - type IP4String string 136 + type IP4String string 137 137 138 138 defined in the Go package, one could add a cue file foo.cue with the following 139 139 contents to allow IP4String to assume only valid IP4 addresses: ··· 180 180 181 181 package foo 182 182 183 - #Switch: int // enumSwitch 183 + #Switch: int // #enumSwitch 184 184 185 - enumSwitch: Off | On 185 + #enumSwitch: Off | On 186 186 187 187 Off: 0 188 188 On: 1 189 189 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, 193 193 include the following constraint in, say, enum.cue, in either the original 194 194 source directory or the generated directory: 195 195 ··· 197 197 198 198 // limit the valid values for Switch to those existing as constants with 199 199 // the same type. 200 - #Switch: enumSwitch 200 + #Switch: #enumSwitch 201 201 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. 206 206 `, 207 207 // - TODO: interpret cuego's struct tags and annotations. 208 208