Skip to content

Commit 00b6c3f

Browse files
authored
Merge pull request #9 from coder/f0ssel/data-race-enum
fix: prevent data race on enum choices
2 parents c842d75 + 3611d97 commit 00b6c3f

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)