]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: allow fieldtrack of unexported fields
authorRuss Cox <rsc@golang.org>
Tue, 22 Feb 2022 19:43:41 +0000 (14:43 -0500)
committerRuss Cox <rsc@golang.org>
Tue, 8 Mar 2022 15:18:31 +0000 (15:18 +0000)
The fieldtrack support is experimental and used mainly inside Google,
where we have included this change for years. No reason not to make
it in the public copy.

Change-Id: I5233e4e775ccce60a17098c007aed8c82a0425d7
Reviewed-on: https://go-review.googlesource.com/c/go/+/387355
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/compile/internal/walk/expr.go

index e5bf6cf0b5e3670a8df0c827f1385ff40251f54d..43201dbd3d4e0dad3bc3ca05e66c933666439f79 100644 (file)
@@ -1012,9 +1012,6 @@ func usefield(n *ir.SelectorExpr) {
        if outer.Sym() == nil {
                base.Errorf("tracked field must be in named struct type")
        }
-       if !types.IsExported(field.Sym.Name) {
-               base.Errorf("tracked field must be exported (upper case)")
-       }
 
        sym := reflectdata.TrackSym(outer, field)
        if ir.CurFunc.FieldTrack == nil {