aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/encoding
diff options
context:
space:
mode:
authorKelsey Hightower <kelsey.hightower@gmail.com>2014-03-06 06:52:18 +1100
committerRob Pike <r@golang.org>2014-03-06 06:52:18 +1100
commit13e359bdca44f204cbeb3368a0ba44c3bc92d55d (patch)
tree46343443937a912502ecd38a7788fa5c077ca75b /src/pkg/encoding
parent58980821c7f8f5412da418365b717eeef4078846 (diff)
downloadgo-13e359bdca44f204cbeb3368a0ba44c3bc92d55d.tar.xz
encoding/gob: improve interface assignment error message
During the glob decoding process interface values are set to concrete values after a test for assignability. If the assignability test fails a slightly vague error message is produced. While technically accurate the error message does not clearly describe the problem. Rewrite the error message to include the usage of the word assignable, which makes it clear the concrete value type is not assignable to the interface value type. Fixes #6467. LGTM=r R=golang-codereviews, rsc, r CC=golang-codereviews https://golang.org/cl/71590043
Diffstat (limited to 'src/pkg/encoding')
-rw-r--r--src/pkg/encoding/gob/decode.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/pkg/encoding/gob/decode.go b/src/pkg/encoding/gob/decode.go
index aa186a582e..d8513148ec 100644
--- a/src/pkg/encoding/gob/decode.go
+++ b/src/pkg/encoding/gob/decode.go
@@ -685,7 +685,7 @@ func (dec *Decoder) ignoreSlice(state *decoderState, elemOp decOp) {
// but first it checks that the assignment will succeed.
func setInterfaceValue(ivalue reflect.Value, value reflect.Value) {
if !value.Type().AssignableTo(ivalue.Type()) {
- errorf("cannot assign value of type %s to %s", value.Type(), ivalue.Type())
+ errorf("%s is not assignable to type %s", value.Type(), ivalue.Type())
}
ivalue.Set(value)
}