Fix the linting errors

This commit is contained in:
Zvonko Kaiser
2022-02-07 12:15:46 +01:00
committed by zvonkok
parent 96f9d0d39e
commit 2c175dcdbf
7 changed files with 55 additions and 23 deletions

View File

@@ -21,10 +21,12 @@ import (
"unsafe"
)
// Raw returns just the bytes without any assumptions about layout
type Raw interface {
Raw() *[]byte
}
// Reader used to read various data sizes in the byte array
type Reader interface {
Read8(pos int) uint8
Read16(pos int) uint16
@@ -33,6 +35,7 @@ type Reader interface {
Len() int
}
// Writer used to write various sizes of data in the byte array
type Writer interface {
Write8(pos int, value uint8)
Write16(pos int, value uint16)
@@ -41,6 +44,7 @@ type Writer interface {
Len() int
}
// Bytes object for manipulating arbitrary byte arrays
type Bytes interface {
Raw
Reader
@@ -66,22 +70,25 @@ func init() {
}
}
// New raw bytearray
func New(data *[]byte) Bytes {
return (*native)(data)
}
// NewLittleEndian little endian ordering of bytes
func NewLittleEndian(data *[]byte) Bytes {
if nativeByteOrder == binary.LittleEndian {
return (*native)(data)
} else {
return (*swapbo)(data)
}
return (*swapbo)(data)
}
// NewBigEndian big endian ordering of bytes
func NewBigEndian(data *[]byte) Bytes {
if nativeByteOrder == binary.BigEndian {
return (*native)(data)
} else {
return (*swapbo)(data)
}
return (*swapbo)(data)
}