Thanks, I was able to solve the problem with the below code and changing
the type to byte.
if err := binary.Read(ConnErr, binary.BigEndian, &data); err
!= nil {
Log.ErrS("Error reading notification message",
log.KV{"err": err})
break
}
msg := ErrorNotifyMessage{
Type: data.Type,
Str: string(data.Str[:bytes.IndexRune(data.Str[:],
0)]),
Name:
string(data.Name[:bytes.IndexRune(data.Name[:], 0)]),
ID: string(data.ID[:bytes.IndexRune(data.ID[:],
0)]),
IP: string(data.IP[:bytes.IndexRune(data.IP[:],
0)]),
}
Regards,
Naveen
On Thu, Aug 16, 2018 at 9:09 AM Jan Mercl <[email protected]> wrote:
> On Thu, Aug 16, 2018 at 5:29 AM <[email protected]> wrote:
>
> > char str[384];
>
> > Str [384]string
>
> The counterpart to C.char is uint8 aka byte. IOW
>
> struct foo {
> char bar[42];
> }
>
> corresponds to
>
> type foo struct {
> bar [42]byte
> }
>
> --
>
> -j
>
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.