diff options
author | Andrew Gerrand <adg@golang.org> | 2011-10-18 14:06:11 +1100 |
---|---|---|
committer | Andrew Gerrand <adg@golang.org> | 2011-10-18 14:06:11 +1100 |
commit | 0584eb2e7779d5bf699702d06acb686cd08bddd2 (patch) | |
tree | 291e3db413833a248a5afbb4cb023e23ca78593e /test/interface/fake.go | |
parent | adfa87c5d754252f2bf428b38560de3d630dbe9d (diff) | |
download | go-0584eb2e7779d5bf699702d06acb686cd08bddd2.tar.gz go-0584eb2e7779d5bf699702d06acb686cd08bddd2.zip |
[release-branch.r58] reflect: disallow Interface method on Value obtained via unexported namerelease.r58.2release-branch.r58
Also remove exp/datafmt that depends on the broken reflect behavior.
««« CL 5267049 / eeca0d4a91a3
reflect: disallow Interface method on Value obtained via unexported name
Had been allowing it for use by fmt, but it is too hard to lock down.
Fix other packages not to depend on it.
R=r, r
CC=golang-dev
https://golang.org/cl/5266054
»»»
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5297042
Diffstat (limited to 'test/interface/fake.go')
-rw-r--r-- | test/interface/fake.go | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/test/interface/fake.go b/test/interface/fake.go index bdc5b9072c..ddb8325427 100644 --- a/test/interface/fake.go +++ b/test/interface/fake.go @@ -12,20 +12,20 @@ package main import "reflect" type T struct { - f float32 - g float32 + F float32 + G float32 - s string - t string + S string + T string - u uint32 - v uint32 + U uint32 + V uint32 - w uint32 - x uint32 + W uint32 + X uint32 - y uint32 - z uint32 + Y uint32 + Z uint32 } func add(s, t string) string { @@ -40,16 +40,16 @@ func assert(b bool) { func main() { var x T - x.f = 1.0 - x.g = x.f - x.s = add("abc", "def") - x.t = add("abc", "def") - x.u = 1 - x.v = 2 - x.w = 1 << 28 - x.x = 2 << 28 - x.y = 0x12345678 - x.z = x.y + x.F = 1.0 + x.G = x.F + x.S = add("abc", "def") + x.T = add("abc", "def") + x.U = 1 + x.V = 2 + x.W = 1 << 28 + x.X = 2 << 28 + x.Y = 0x12345678 + x.Z = x.Y // check mem and string v := reflect.ValueOf(x) |