aboutsummaryrefslogtreecommitdiff
path: root/src/reflect
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2021-06-14 14:30:46 -0700
committerIan Lance Taylor <iant@golang.org>2021-06-14 21:46:05 +0000
commit0fd20ed5b67a950c7085b20c36dbfd9a70d2bfda (patch)
treee658ea60e95d39138d1df1f0319e03401b471e59 /src/reflect
parent6bbb0a9d4a086af04d8eb16e17d1b144622a86f5 (diff)
downloadgo-0fd20ed5b67a950c7085b20c36dbfd9a70d2bfda.tar.gz
go-0fd20ed5b67a950c7085b20c36dbfd9a70d2bfda.zip
reflect: use same conversion panic in reflect and runtime
Consistently say "pointer to array", not "array pointer". Fixes #46743 Change-Id: I2388ec5c16f96e82a3a383b9b462b350686ddc5e Reviewed-on: https://go-review.googlesource.com/c/go/+/327870 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'src/reflect')
-rw-r--r--src/reflect/all_test.go2
-rw-r--r--src/reflect/value.go2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/reflect/all_test.go b/src/reflect/all_test.go
index 17104ad4fa..0db5e13217 100644
--- a/src/reflect/all_test.go
+++ b/src/reflect/all_test.go
@@ -4371,7 +4371,7 @@ func TestConvertPanic(t *testing.T) {
if !v.Type().ConvertibleTo(pt) {
t.Errorf("[]byte should be convertible to *[8]byte")
}
- shouldPanic("reflect: cannot convert slice with length 4 to array pointer with length 8", func() {
+ shouldPanic("reflect: cannot convert slice with length 4 to pointer to array with length 8", func() {
_ = v.Convert(pt)
})
}
diff --git a/src/reflect/value.go b/src/reflect/value.go
index c963a407bc..6ba6202a1a 100644
--- a/src/reflect/value.go
+++ b/src/reflect/value.go
@@ -3067,7 +3067,7 @@ func cvtSliceArrayPtr(v Value, t Type) Value {
n := t.Elem().Len()
h := (*unsafeheader.Slice)(v.ptr)
if n > h.Len {
- panic("reflect: cannot convert slice with length " + itoa.Itoa(h.Len) + " to array pointer with length " + itoa.Itoa(n))
+ panic("reflect: cannot convert slice with length " + itoa.Itoa(h.Len) + " to pointer to array with length " + itoa.Itoa(n))
}
return Value{t.common(), h.Data, v.flag&^(flagIndir|flagAddr|flagKindMask) | flag(Ptr)}
}