Skip to content

Commit 6bb77fe

Browse files
committed
Now checking if a field is not anonymous before
skipping it when walking over values in an struct, to make sure that we don't skip validly accessible (exported) embedded values in an unexported field. This new checking logic is the new recommended strategy for reflective struct walking as of the Go 1.6 release. Related/References: - Go 1.6 reflect release note: https://golang.org/doc/go1.6#reflect - Issue: https://golang.org/issue/12367 (golang/go#12367) - CL: https://golang.org/cl/14085 (https://go-review.googlesource.com/#/c/14085/) - Commit: golang/go@afe9837
1 parent 4ef3313 commit 6bb77fe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

query/encode.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ func reflectValue(values url.Values, val reflect.Value, scope string) error {
138138
typ := val.Type()
139139
for i := 0; i < typ.NumField(); i++ {
140140
sf := typ.Field(i)
141-
if sf.PkgPath != "" { // unexported
141+
if sf.PkgPath != "" && !sf.Anonymous { // unexported
142142
continue
143143
}
144144

0 commit comments

Comments
 (0)