Firstly apologies if my title is unclear or the wrong terminology is used - I can edit if anyone can suggest better
I want to print on a web page the data for the userSessionID but the data is of different types. For example I tried to do a .(string) type assertion for Value in the Object Map but I got this error:
panic…interface conversion: interface {} is uint8, not *string
So I think it’s best to create a switch for Value, except I don’t know where to start, even from looking at the go docs.
From your code i don’t see where you have done a type assertion. Could you please include it. And like @christophberger has commented it would help if you provided us with the line raising the panic.
When you are expecting any type use value.(type)
and then use a switch on the types
When you are only interested in a particular type and you know the value will be of that type use value.(typeName) But this has one draw back if the value is of a different type then a panic will be raised
Thanks for the answers, fortunately my error was fixed but not by me, but unfortunately the file has been overwritten so I have no way of showing other the solution but nevertheless the answers should be enough to provide others with a better idea.