bencode-go
bencode-go copied to clipboard
panic: setint called for bogus type: string
Thank you for reporting this issue!
Unfortunately I don't have a Windows machine to run the sample executable that you have provided. (And if I did, I would be worried about a possible virus.) Could you paste the panic stack trace, or provide a source code version of the sample?
I read through the source code for bencode-go/struct.go, and it looks like this panic can happen when trying to deserialize a bencode integer into a go struct that has a string field.
I don't think this is an error in the bencode library. Instead, I think it is due to a mis-match between the format of the encoded data and the struct you are trying to deserialize into.
A work-around would be to use the Decode API to return generic Go data structures, and then pick through the generic Go data on your own.
@jackpal Thanks for your reply. This sample.zip just a torrent file, It is not an executable file. sample_2.zip