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
go 1.4.2 windows7 x64
package main import( "fmt" "bytes" "encoding/binary" ) type Header struct { IsFull bool } func main(){ a:=make([]byte,1024,1024) for i:=0;i<1024;i++{ a[i]=byte(i) } var pi Header buf := bytes.NewReader(a) err := binary.Read(buf, binary.LittleEndian, &pi) fmt.Println(err) }
result: "binary.Read: invalid type *main.Header"
but, if o change type of Header.IsFull from bool to byte or int8 (or something else int*), then all works done
The text was updated successfully, but these errors were encountered:
This is working as expected. The encoding/binary package, as the documentation says, "implements simple translation between numbers and byte sequences." The type bool is not a number.
Sorry, something went wrong.
No branches or pull requests
go 1.4.2 windows7 x64
result: "binary.Read: invalid type *main.Header"
but, if o change type of Header.IsFull from bool to byte or int8 (or something else int*), then all works done
The text was updated successfully, but these errors were encountered: