Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(reflect): not assignable to type #359

Merged
merged 1 commit into from
Oct 26, 2023

Conversation

choyri
Copy link
Contributor

@choyri choyri commented Oct 25, 2023

Bug introduced in this, which causes the panic:

--- FAIL: TestPtrValueDecode (0.00s)
panic: reflect.Set: value of type **int is not assignable to type *int [recovered]
	panic: reflect.Set: value of type **int is not assignable to type *int

goroutine 91 [running]:
testing.tRunner.func1.2({0x7775c0, 0xc0001fc990})
	/usr/local/go/src/testing/testing.go:1545 +0x238
testing.tRunner.func1()
	/usr/local/go/src/testing/testing.go:1548 +0x397
panic({0x7775c0?, 0xc0001fc990?})
	/usr/local/go/src/runtime/panic.go:914 +0x21f
reflect.Value.assignTo({0x772ec0?, 0xc000044898?, 0xc000128901?}, {0x7edcc3, 0xb}, 0x76c860, 0x0)
	/usr/local/go/src/reflect/value.go:3307 +0x289
reflect.Value.Set({0x76c860?, 0xc000044848?, 0x76c860?}, {0x772ec0?, 0xc000044898?, 0xc000044838?})
	/usr/local/go/src/reflect/value.go:2260 +0xe6
github.com/vmihailenco/msgpack/v5.ptrValueDecoder.func1(0x79cbc0?, {0x76c860?, 0xc000044848?, 0xc000014b30?})
	/go/msgpack/decode_value.go:131 +0x127
github.com/vmihailenco/msgpack/v5.(*field).DecodeValue(0xc0001f1a80, 0xc000101980?, {0x79cbc0?, 0xc000044848?, 0x0?})
	/go/msgpack/types.go:119 +0x63
github.com/vmihailenco/msgpack/v5.(*Decoder).decodeStruct(0xc000163050, {0x79cbc0?, 0xc000044848?, 0x40f21a?}, 0x1)
	/go/msgpack/decode_map.go:341 +0x199
github.com/vmihailenco/msgpack/v5.decodeStructValue(0xc000163050, {0x79cbc0?, 0xc000044848?, 0x16?})
	/go/msgpack/decode_map.go:299 +0x1b0
github.com/vmihailenco/msgpack/v5.(*Decoder).DecodeValue(0x76b8a0?, {0x79cbc0?, 0xc000044848?, 0xc000500000?})
	/go/msgpack/decode.go:332 +0x7a
github.com/vmihailenco/msgpack/v5.(*Decoder).Decode(0xc000163050?, {0x76b8a0?, 0xc000044848?})
	/go/msgpack/decode.go:311 +0x772
github.com/vmihailenco/msgpack/v5.Unmarshal({0xc000128fc0, 0x6, 0x40}, {0x76b8a0, 0xc000044848})
	/go/msgpack/decode.go:60 +0x125
github.com/vmihailenco/msgpack/v5_test.TestPtrValueDecode(0xc0005036c0?)
	/go/msgpack/msgpack_test.go:543 +0xd8
testing.tRunner(0xc000503d40, 0x8206c0)
	/usr/local/go/src/testing/testing.go:1595 +0xff
created by testing.(*T).Run in goroutine 1
	/usr/local/go/src/testing/testing.go:1648 +0x3ad
FAIL	github.com/vmihailenco/msgpack/v5	0.026s
FAIL

@vmihailenco vmihailenco merged commit 6eedee3 into vmihailenco:v5 Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants