Skip to content

Commit 3611d97

Browse files
committed
fix: prevent data race on enum choices
1 parent c842d75 commit 3611d97

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

values.go

+2
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,8 @@ type Enum struct {
493493
}
494494

495495
func EnumOf(v *string, choices ...string) *Enum {
496+
// copy choices to avoid data race during unmarshaling
497+
choices = append([]string{}, choices...)
496498
return &Enum{
497499
Choices: choices,
498500
Value: v,

0 commit comments

Comments
 (0)