Skip to content

Commit c65768f

Browse files
committed
Fix: panic in struct level example
Accessing an array element at index 3 causes index out of range panic
1 parent b328f72 commit c65768f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

_examples/struct-level/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func (gender Gender) String() string {
3636
if gender < Male || gender > Intersex {
3737
return "unknown"
3838
}
39-
return terms[gender]
39+
return terms[gender-1]
4040
}
4141

4242
// User contains user information

0 commit comments

Comments
 (0)