latest
This commit is contained in:
@@ -5,9 +5,11 @@ import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
var ErrMissingMagic = errors.New("missing magic bytes in file")
|
||||
var ErrFileTruncated = errors.New("file/stream is truncated abnormally")
|
||||
var (
|
||||
ErrMissingMagic = errors.New("missing magic bytes in file")
|
||||
ErrFileTruncated = errors.New("file/stream is truncated abnormally")
|
||||
)
|
||||
|
||||
func Newf(format string, args ...interface{}) error {
|
||||
return errors.New(fmt.Sprintf(format, args...))
|
||||
return fmt.Errorf(format, args...)
|
||||
}
|
||||
|
||||
11
internal/bork/error_test.go
Normal file
11
internal/bork/error_test.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package bork
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestBuild(t *testing.T) {
|
||||
assert.NotNil(t, ErrMissingMagic)
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package cli
|
||||
|
||||
import "fmt"
|
||||
|
||||
// FIXME make this write to a bytes.Buffer with fprintf
|
||||
func DumpByteSlice(b []byte) {
|
||||
var a [16]byte
|
||||
n := (len(b) + 15) &^ 15
|
||||
for i := 0; i < n; i++ {
|
||||
if i%16 == 0 {
|
||||
fmt.Printf("%4d", i)
|
||||
}
|
||||
if i%8 == 0 {
|
||||
fmt.Print(" ")
|
||||
}
|
||||
if i < len(b) {
|
||||
fmt.Printf(" %02X", b[i])
|
||||
} else {
|
||||
fmt.Print(" ")
|
||||
}
|
||||
if i >= len(b) {
|
||||
a[i%16] = ' '
|
||||
} else if b[i] < 32 || b[i] > 126 {
|
||||
a[i%16] = '.'
|
||||
} else {
|
||||
a[i%16] = b[i]
|
||||
}
|
||||
if i%16 == 15 {
|
||||
fmt.Printf(" %s\n", string(a[:]))
|
||||
}
|
||||
}
|
||||
}
|
||||
12
internal/log/log_test.go
Normal file
12
internal/log/log_test.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package log
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestBuild(t *testing.T) {
|
||||
Init()
|
||||
assert.True(t, true)
|
||||
}
|
||||
Reference in New Issue
Block a user