Skip to content

Commit 8b83737

Browse files
committed
v0.4.4 fix for enums that begin with a b
1 parent f8b6f8f commit 8b83737

File tree

24 files changed

+194
-194
lines changed

24 files changed

+194
-194
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build variables
2-
VERSION := v0.4.3
2+
VERSION := v0.4.4
33
BUILD_TIME := $(shell date +%Y%m%d-%H:%M:%S)
44
GIT_COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
55
GIT_DIRTY := $(shell if [ -n "$$(git status --porcelain)" ]; then echo "-dirty"; fi)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ Produces a go output file called `planets_enums.go` with the following content:
494494

495495
```go
496496
// DO NOT EDIT.
497-
// code generated by goenums 'v0.4.3' at Jun 30 00:49:56.
497+
// code generated by goenums 'v0.4.4' at Jun 30 00:49:56.
498498
//
499499
// github.com/zarldev/goenums
500500
//

docs/_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Type-safe enum generation for Go
44
url: "https://zarldev.github.io/goenums"
55
baseurl: "/goenums"
66
repository: "zarldev/goenums"
7-
version: "0.4.3"
7+
version: "0.4.4"
88

99
# Build settings
1010
markdown: kramdown

docs/installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ You should see the `goenums` logo and current version displayed:
3333
/____/
3434

3535
https://zarldev.github.io/goenums
36-
version :: v0.4.3
36+
version :: v0.4.4
3737
build :: 20250528-00:39:58
3838
commit :: 1b2f884-dirty
3939
```

examples/sale/discounttypes_enums.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// DO NOT EDIT.
2-
// code generated by goenums 'v0.4.3' at Jun 30 01:47:17.
2+
// code generated by goenums 'v0.4.4' at Sep 12 23:21:16.
33
//
44
// github.com/zarldev/goenums
55
//
@@ -251,9 +251,9 @@ func (d DiscountType) MarshalJSON() ([]byte, error) {
251251
// UnmarshalJSON implements the json.Unmarshaler interface for DiscountType.
252252
// It parses the JSON representation of the enum value from the byte slice.
253253
// It returns an error if the input is not a valid JSON representation.
254-
func (d *DiscountType) UnmarshalJSON(b []byte) error {
255-
b = bytes.Trim(bytes.Trim(b, "\""), "\"")
256-
newd, err := ParseDiscountType(b)
254+
func (d *DiscountType) UnmarshalJSON(by []byte) error {
255+
by = bytes.Trim(bytes.Trim(by, "\""), "\"")
256+
newd, err := ParseDiscountType(by)
257257
if err != nil {
258258
return err
259259
}
@@ -270,8 +270,8 @@ func (d DiscountType) MarshalText() ([]byte, error) {
270270
// UnmarshalText implements the encoding.TextUnmarshaler interface for DiscountType.
271271
// It parses the string representation of the enum value from the byte slice.
272272
// It returns an error if the byte slice does not contain a valid enum value.
273-
func (d *DiscountType) UnmarshalText(b []byte) error {
274-
newd, err := ParseDiscountType(b)
273+
func (d *DiscountType) UnmarshalText(by []byte) error {
274+
newd, err := ParseDiscountType(by)
275275
if err != nil {
276276
return err
277277
}
@@ -306,8 +306,8 @@ func (d DiscountType) MarshalBinary() ([]byte, error) {
306306
// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for DiscountType.
307307
// It parses the binary representation of the enum value from the byte slice.
308308
// It returns an error if the byte slice does not contain a valid enum value.
309-
func (d *DiscountType) UnmarshalBinary(b []byte) error {
310-
newd, err := ParseDiscountType(b)
309+
func (d *DiscountType) UnmarshalBinary(by []byte) error {
310+
newd, err := ParseDiscountType(by)
311311
if err != nil {
312312
return err
313313
}
@@ -324,8 +324,8 @@ func (d DiscountType) MarshalYAML() ([]byte, error) {
324324
// UnmarshalYAML implements the yaml.Unmarshaler interface for Planet.
325325
// It parses the byte slice representation of the enum value and returns an error
326326
// if the YAML byte slice does not contain a valid enum value.
327-
func (d *DiscountType) UnmarshalYAML(b []byte) error {
328-
newd, err := ParseDiscountType(b)
327+
func (d *DiscountType) UnmarshalYAML(by []byte) error {
328+
newd, err := ParseDiscountType(by)
329329
if err != nil {
330330
return err
331331
}

examples/salesimple/discounttypes_enums.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// DO NOT EDIT.
2-
// code generated by goenums 'v0.4.3' at Jun 30 01:47:17.
2+
// code generated by goenums 'v0.4.4' at Sep 12 23:21:16.
33
//
44
// github.com/zarldev/goenums
55
//
@@ -251,9 +251,9 @@ func (d DiscountType) MarshalJSON() ([]byte, error) {
251251
// UnmarshalJSON implements the json.Unmarshaler interface for DiscountType.
252252
// It parses the JSON representation of the enum value from the byte slice.
253253
// It returns an error if the input is not a valid JSON representation.
254-
func (d *DiscountType) UnmarshalJSON(b []byte) error {
255-
b = bytes.Trim(bytes.Trim(b, "\""), "\"")
256-
newd, err := ParseDiscountType(b)
254+
func (d *DiscountType) UnmarshalJSON(by []byte) error {
255+
by = bytes.Trim(bytes.Trim(by, "\""), "\"")
256+
newd, err := ParseDiscountType(by)
257257
if err != nil {
258258
return err
259259
}
@@ -270,8 +270,8 @@ func (d DiscountType) MarshalText() ([]byte, error) {
270270
// UnmarshalText implements the encoding.TextUnmarshaler interface for DiscountType.
271271
// It parses the string representation of the enum value from the byte slice.
272272
// It returns an error if the byte slice does not contain a valid enum value.
273-
func (d *DiscountType) UnmarshalText(b []byte) error {
274-
newd, err := ParseDiscountType(b)
273+
func (d *DiscountType) UnmarshalText(by []byte) error {
274+
newd, err := ParseDiscountType(by)
275275
if err != nil {
276276
return err
277277
}
@@ -306,8 +306,8 @@ func (d DiscountType) MarshalBinary() ([]byte, error) {
306306
// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for DiscountType.
307307
// It parses the binary representation of the enum value from the byte slice.
308308
// It returns an error if the byte slice does not contain a valid enum value.
309-
func (d *DiscountType) UnmarshalBinary(b []byte) error {
310-
newd, err := ParseDiscountType(b)
309+
func (d *DiscountType) UnmarshalBinary(by []byte) error {
310+
newd, err := ParseDiscountType(by)
311311
if err != nil {
312312
return err
313313
}
@@ -324,8 +324,8 @@ func (d DiscountType) MarshalYAML() ([]byte, error) {
324324
// UnmarshalYAML implements the yaml.Unmarshaler interface for Planet.
325325
// It parses the byte slice representation of the enum value and returns an error
326326
// if the YAML byte slice does not contain a valid enum value.
327-
func (d *DiscountType) UnmarshalYAML(b []byte) error {
328-
newd, err := ParseDiscountType(b)
327+
func (d *DiscountType) UnmarshalYAML(by []byte) error {
328+
newd, err := ParseDiscountType(by)
329329
if err != nil {
330330
return err
331331
}

examples/solarsystem/planets_enums.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// DO NOT EDIT.
2-
// code generated by goenums 'v0.4.3' at Jun 30 01:47:17.
2+
// code generated by goenums 'v0.4.4' at Sep 12 23:21:16.
33
//
44
// github.com/zarldev/goenums
55
//
@@ -322,9 +322,9 @@ func (p Planet) MarshalJSON() ([]byte, error) {
322322
// UnmarshalJSON implements the json.Unmarshaler interface for Planet.
323323
// It parses the JSON representation of the enum value from the byte slice.
324324
// It returns an error if the input is not a valid JSON representation.
325-
func (p *Planet) UnmarshalJSON(b []byte) error {
326-
b = bytes.Trim(bytes.Trim(b, "\""), "\"")
327-
newp, err := ParsePlanet(b)
325+
func (p *Planet) UnmarshalJSON(by []byte) error {
326+
by = bytes.Trim(bytes.Trim(by, "\""), "\"")
327+
newp, err := ParsePlanet(by)
328328
if err != nil {
329329
return err
330330
}
@@ -341,8 +341,8 @@ func (p Planet) MarshalText() ([]byte, error) {
341341
// UnmarshalText implements the encoding.TextUnmarshaler interface for Planet.
342342
// It parses the string representation of the enum value from the byte slice.
343343
// It returns an error if the byte slice does not contain a valid enum value.
344-
func (p *Planet) UnmarshalText(b []byte) error {
345-
newp, err := ParsePlanet(b)
344+
func (p *Planet) UnmarshalText(by []byte) error {
345+
newp, err := ParsePlanet(by)
346346
if err != nil {
347347
return err
348348
}
@@ -377,8 +377,8 @@ func (p Planet) MarshalBinary() ([]byte, error) {
377377
// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for Planet.
378378
// It parses the binary representation of the enum value from the byte slice.
379379
// It returns an error if the byte slice does not contain a valid enum value.
380-
func (p *Planet) UnmarshalBinary(b []byte) error {
381-
newp, err := ParsePlanet(b)
380+
func (p *Planet) UnmarshalBinary(by []byte) error {
381+
newp, err := ParsePlanet(by)
382382
if err != nil {
383383
return err
384384
}
@@ -395,8 +395,8 @@ func (p Planet) MarshalYAML() ([]byte, error) {
395395
// UnmarshalYAML implements the yaml.Unmarshaler interface for Planet.
396396
// It parses the byte slice representation of the enum value and returns an error
397397
// if the YAML byte slice does not contain a valid enum value.
398-
func (p *Planet) UnmarshalYAML(b []byte) error {
399-
newp, err := ParsePlanet(b)
398+
func (p *Planet) UnmarshalYAML(by []byte) error {
399+
newp, err := ParsePlanet(by)
400400
if err != nil {
401401
return err
402402
}

examples/solarsystemsimple/planets_enums.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// DO NOT EDIT.
2-
// code generated by goenums 'v0.4.3' at Jun 30 01:47:17.
2+
// code generated by goenums 'v0.4.4' at Sep 12 23:21:16.
33
//
44
// github.com/zarldev/goenums
55
//
@@ -265,9 +265,9 @@ func (p Planet) MarshalJSON() ([]byte, error) {
265265
// UnmarshalJSON implements the json.Unmarshaler interface for Planet.
266266
// It parses the JSON representation of the enum value from the byte slice.
267267
// It returns an error if the input is not a valid JSON representation.
268-
func (p *Planet) UnmarshalJSON(b []byte) error {
269-
b = bytes.Trim(bytes.Trim(b, "\""), "\"")
270-
newp, err := ParsePlanet(b)
268+
func (p *Planet) UnmarshalJSON(by []byte) error {
269+
by = bytes.Trim(bytes.Trim(by, "\""), "\"")
270+
newp, err := ParsePlanet(by)
271271
if err != nil {
272272
return err
273273
}
@@ -284,8 +284,8 @@ func (p Planet) MarshalText() ([]byte, error) {
284284
// UnmarshalText implements the encoding.TextUnmarshaler interface for Planet.
285285
// It parses the string representation of the enum value from the byte slice.
286286
// It returns an error if the byte slice does not contain a valid enum value.
287-
func (p *Planet) UnmarshalText(b []byte) error {
288-
newp, err := ParsePlanet(b)
287+
func (p *Planet) UnmarshalText(by []byte) error {
288+
newp, err := ParsePlanet(by)
289289
if err != nil {
290290
return err
291291
}
@@ -320,8 +320,8 @@ func (p Planet) MarshalBinary() ([]byte, error) {
320320
// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for Planet.
321321
// It parses the binary representation of the enum value from the byte slice.
322322
// It returns an error if the byte slice does not contain a valid enum value.
323-
func (p *Planet) UnmarshalBinary(b []byte) error {
324-
newp, err := ParsePlanet(b)
323+
func (p *Planet) UnmarshalBinary(by []byte) error {
324+
newp, err := ParsePlanet(by)
325325
if err != nil {
326326
return err
327327
}
@@ -338,8 +338,8 @@ func (p Planet) MarshalYAML() ([]byte, error) {
338338
// UnmarshalYAML implements the yaml.Unmarshaler interface for Planet.
339339
// It parses the byte slice representation of the enum value and returns an error
340340
// if the YAML byte slice does not contain a valid enum value.
341-
func (p *Planet) UnmarshalYAML(b []byte) error {
342-
newp, err := ParsePlanet(b)
341+
func (p *Planet) UnmarshalYAML(by []byte) error {
342+
newp, err := ParsePlanet(by)
343343
if err != nil {
344344
return err
345345
}

examples/validation/statuses_enums.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// DO NOT EDIT.
2-
// code generated by goenums 'v0.4.3' at Jun 30 01:47:17.
2+
// code generated by goenums 'v0.4.4' at Sep 12 23:21:16.
33
//
44
// github.com/zarldev/goenums
55
//
@@ -243,9 +243,9 @@ func (s Status) MarshalJSON() ([]byte, error) {
243243
// UnmarshalJSON implements the json.Unmarshaler interface for Status.
244244
// It parses the JSON representation of the enum value from the byte slice.
245245
// It returns an error if the input is not a valid JSON representation.
246-
func (s *Status) UnmarshalJSON(b []byte) error {
247-
b = bytes.Trim(bytes.Trim(b, "\""), "\"")
248-
news, err := ParseStatus(b)
246+
func (s *Status) UnmarshalJSON(by []byte) error {
247+
by = bytes.Trim(bytes.Trim(by, "\""), "\"")
248+
news, err := ParseStatus(by)
249249
if err != nil {
250250
return err
251251
}
@@ -262,8 +262,8 @@ func (s Status) MarshalText() ([]byte, error) {
262262
// UnmarshalText implements the encoding.TextUnmarshaler interface for Status.
263263
// It parses the string representation of the enum value from the byte slice.
264264
// It returns an error if the byte slice does not contain a valid enum value.
265-
func (s *Status) UnmarshalText(b []byte) error {
266-
news, err := ParseStatus(b)
265+
func (s *Status) UnmarshalText(by []byte) error {
266+
news, err := ParseStatus(by)
267267
if err != nil {
268268
return err
269269
}
@@ -298,8 +298,8 @@ func (s Status) MarshalBinary() ([]byte, error) {
298298
// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for Status.
299299
// It parses the binary representation of the enum value from the byte slice.
300300
// It returns an error if the byte slice does not contain a valid enum value.
301-
func (s *Status) UnmarshalBinary(b []byte) error {
302-
news, err := ParseStatus(b)
301+
func (s *Status) UnmarshalBinary(by []byte) error {
302+
news, err := ParseStatus(by)
303303
if err != nil {
304304
return err
305305
}
@@ -316,8 +316,8 @@ func (s Status) MarshalYAML() ([]byte, error) {
316316
// UnmarshalYAML implements the yaml.Unmarshaler interface for Planet.
317317
// It parses the byte slice representation of the enum value and returns an error
318318
// if the YAML byte slice does not contain a valid enum value.
319-
func (s *Status) UnmarshalYAML(b []byte) error {
320-
news, err := ParseStatus(b)
319+
func (s *Status) UnmarshalYAML(by []byte) error {
320+
news, err := ParseStatus(by)
321321
if err != nil {
322322
return err
323323
}

generator/gofile/gofile_writer.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ func ({{ .Receiver }} {{ .WrapperName }}) MarshalJSON() ([]byte, error) {
173173
// UnmarshalJSON implements the json.Unmarshaler interface for {{ .WrapperName }}.
174174
// It parses the JSON representation of the enum value from the byte slice.
175175
// It returns an error if the input is not a valid JSON representation.
176-
func ({{ .Receiver }} *{{ .WrapperName }}) UnmarshalJSON(b []byte) error {
177-
b = bytes.Trim(bytes.Trim(b, "\""), "\"")
178-
new{{ .Receiver }}, err := Parse{{ .WrapperName }}(b)
176+
func ({{ .Receiver }} *{{ .WrapperName }}) UnmarshalJSON(by []byte) error {
177+
by = bytes.Trim(bytes.Trim(by, "\""), "\"")
178+
new{{ .Receiver }}, err := Parse{{ .WrapperName }}(by)
179179
if err != nil {
180180
return err
181181
}
@@ -244,8 +244,8 @@ var (
244244
// UnmarshalText implements the encoding.TextUnmarshaler interface for {{ .WrapperName }}.
245245
// It parses the string representation of the enum value from the byte slice.
246246
// It returns an error if the byte slice does not contain a valid enum value.
247-
func ({{ .Receiver }} *{{ .WrapperName }}) UnmarshalText(b []byte) error {
248-
new{{ .Receiver }}, err := Parse{{ .WrapperName }}(b)
247+
func ({{ .Receiver }} *{{ .WrapperName }}) UnmarshalText(by []byte) error {
248+
new{{ .Receiver }}, err := Parse{{ .WrapperName }}(by)
249249
if err != nil {
250250
return err
251251
}
@@ -278,8 +278,8 @@ func ({{ .Receiver }} {{ .WrapperName }}) MarshalBinary() ([]byte, error) {
278278
// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for {{ .WrapperName }}.
279279
// It parses the binary representation of the enum value from the byte slice.
280280
// It returns an error if the byte slice does not contain a valid enum value.
281-
func ({{ .Receiver }} *{{ .WrapperName }}) UnmarshalBinary(b []byte) error {
282-
new{{ .Receiver }}, err := Parse{{ .WrapperName }}(b)
281+
func ({{ .Receiver }} *{{ .WrapperName }}) UnmarshalBinary(by []byte) error {
282+
new{{ .Receiver }}, err := Parse{{ .WrapperName }}(by)
283283
if err != nil {
284284
return err
285285
}
@@ -312,8 +312,8 @@ func ({{ .Receiver }} {{ .WrapperName }}) MarshalYAML() ([]byte, error) {
312312
// UnmarshalYAML implements the yaml.Unmarshaler interface for Planet.
313313
// It parses the byte slice representation of the enum value and returns an error
314314
// if the YAML byte slice does not contain a valid enum value.
315-
func ({{ .Receiver }} *{{ .WrapperName }}) UnmarshalYAML(b []byte) error {
316-
new{{ .Receiver }}, err := Parse{{ .WrapperName }}(b)
315+
func ({{ .Receiver }} *{{ .WrapperName }}) UnmarshalYAML(by []byte) error {
316+
new{{ .Receiver }}, err := Parse{{ .WrapperName }}(by)
317317
if err != nil {
318318
return err
319319
}

0 commit comments

Comments
 (0)