Skip to content

Commit 6d8aaec

Browse files
committed
Allow multiple "_" fields in reflect.StructOf().
This addresses golang/go#49110 for GopherJS.
1 parent 8af68a2 commit 6d8aaec

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/natives/src/reflect/reflect.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ func StructOf(fields []StructField) Type {
495495
}
496496
}
497497

498-
if _, dup := fset[name]; dup {
498+
if _, dup := fset[name]; dup && name != "_" {
499499
panic("reflect.StructOf: duplicate field " + name)
500500
}
501501
fset[name] = struct{}{}

0 commit comments

Comments
 (0)