package msgioimport ()// NBO is NetworkByteOrdervarNBO = binary.BigEndian// WriteLen writes a length to the given writer.func ( io.Writer, int) error { := uint32()returnbinary.Write(, NBO, &)}// ReadLen reads a length from the given reader.// if buf is non-nil, it reuses the buffer. Ex://// l, err := ReadLen(r, nil)// _, err := ReadLen(r, buf)func ( io.Reader, []byte) (int, error) {iflen() < 4 { = make([]byte, 4) } = [:4]if , := io.ReadFull(, ); != nil {return0, } := int(NBO.Uint32())return , nil}
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.