forked from TrueCloudLab/neoneo-go
io: add a note for WriteArray, fix #519
It can't be really solved in many cases (it's used in P2P protocol and we have to follow the usual conventions there) and in most of the cases we don't care about the difference between nil slice and zero-length slice.
This commit is contained in:
parent
f1856bfa8b
commit
35e368c241
1 changed files with 3 additions and 1 deletions
|
@ -35,7 +35,9 @@ func (w *BinWriter) WriteBE(v interface{}) {
|
|||
w.Err = binary.Write(w.w, binary.BigEndian, v)
|
||||
}
|
||||
|
||||
// WriteArray writes a slice or an array arr into w.
|
||||
// WriteArray writes a slice or an array arr into w. Note that nil slices and
|
||||
// empty slices are gonna be treated the same resulting in equal zero-length
|
||||
// array encoded.
|
||||
func (w *BinWriter) WriteArray(arr interface{}) {
|
||||
switch val := reflect.ValueOf(arr); val.Kind() {
|
||||
case reflect.Slice, reflect.Array:
|
||||
|
|
Loading…
Reference in a new issue