func ScanNullTerm(data []byte, atEOF bool) (int, []byte, error) {
	// if we're at EOF, we're done for now
	if atEOF && len(data) == 0 {
		return 0, nil, nil
	}

	// if we find a '\000', return the data up to and including that index
	if i := bytes.IndexByte(data, '\000'); i >= 0 {
		// there is a null-terminated frame
		return i + 1, data[0:i], nil
	}

	// if we did not find a null-terminated frame, still need to check for \n
	if len(data) > 0 && data[0] == '\n' {
		return 1, []byte{data[0]}, nil
	}

	// if we are at EOF and we have data, return it so we can see what's going on
	if atEOF {
		return len(data), data, nil
	}
	return 0, nil, nil
}
// Custom scanner to split incoming stream on \000
Custom scanner to split incoming stream on \000
// Custom scanner to split incoming stream on \ 000
func ScanNullTerm(data []byte, atEOF bool) (int, []byte, error) {
	if atEOF && len(data) == 0 {
		return 0, nil, nil
	}
	if i := bytes.IndexByte(data, '\000'); i >= 0 {
		return i + 1, data[0:i], nil
	}
	if len(data) > 0 && data[0] == '\n' {
		return 1, []byte{data[0]}, nil
	}
	if atEOF {
		return len(data), data, nil
	}
	return 0, nil, nil
}
func ScanNullTerm ( data [ ] byte , atEOF bool ) ( int , [ ] byte , error ) { if atEOF && len ( data ) == 0 { return 0 , nil , nil } if i := bytes . IndexByte ( data , '\000' ) ; i >= 0 { return i + 1 , data [ 0 : i ] , nil } if len ( data ) > 0 && data [ 0 ] == '\n' { return 1 , [ ] byte { data [ 0 ] } , nil } if atEOF { return len ( data ) , data , nil } return 0 , nil , nil }
Custom scanner to split incoming stream on \000
Custom scanner to split incoming stream on \ 000
// if we're at EOF, we're done for now // if we find a '\000', return the data up to and including that index // there is a null-terminated frame // if we did not find a null-terminated frame, still need to check for \n // if we are at EOF and we have data, return it so we can see what's going on