lint: errcheck (#5091)

## Description

add more error checks to tests


gonna do a third PR that tackles the non test cases
This commit is contained in:
Marko
2020-07-14 11:04:41 +00:00
committed by GitHub
parent 0825d57cf7
commit 6ccccb0933
32 changed files with 773 additions and 229 deletions
+14 -5
View File
@@ -59,8 +59,7 @@ func main() {
os.Exit(1)
}
err = group.Start()
if err != nil {
if err = group.Start(); err != nil {
fmt.Printf("logjack couldn't start with file %v\n", headPath)
os.Exit(1)
}
@@ -69,10 +68,11 @@ func main() {
buf := make([]byte, readBufferSize)
for {
n, err := os.Stdin.Read(buf)
group.Write(buf[:n])
group.FlushAndSync()
if err != nil {
group.Stop()
if err := group.Stop(); err != nil {
fmt.Fprintf(os.Stderr, "logjack stopped with error %v\n", headPath)
os.Exit(1)
}
if err == io.EOF {
os.Exit(0)
} else {
@@ -80,6 +80,15 @@ func main() {
os.Exit(1)
}
}
_, err = group.Write(buf[:n])
if err != nil {
fmt.Fprintf(os.Stderr, "logjack failed write with error %v\n", headPath)
os.Exit(1)
}
if err := group.FlushAndSync(); err != nil {
fmt.Fprintf(os.Stderr, "logjack flushsync fail with error %v\n", headPath)
os.Exit(1)
}
}
}