errors: formating cleanup (#7507)

This commit is contained in:
Sam Kleinman
2022-01-04 16:11:28 -05:00
committed by GitHub
parent a67e0e6c43
commit 3c8955e4b8
47 changed files with 136 additions and 167 deletions
+5 -5
View File
@@ -27,13 +27,13 @@ func main() {
f, err := os.Open(os.Args[1])
if err != nil {
panic(fmt.Errorf("failed to open WAL file: %v", err))
panic(fmt.Errorf("failed to open WAL file: %w", err))
}
defer f.Close()
walFile, err := os.OpenFile(os.Args[2], os.O_EXCL|os.O_WRONLY|os.O_CREATE, 0666)
if err != nil {
panic(fmt.Errorf("failed to open WAL file: %v", err))
panic(fmt.Errorf("failed to open WAL file: %w", err))
}
defer walFile.Close()
@@ -48,7 +48,7 @@ func main() {
if err == io.EOF {
break
} else if err != nil {
panic(fmt.Errorf("failed to read file: %v", err))
panic(fmt.Errorf("failed to read file: %w", err))
}
// ignore the ENDHEIGHT in json.File
if strings.HasPrefix(string(msgJSON), "ENDHEIGHT") {
@@ -58,12 +58,12 @@ func main() {
var msg consensus.TimedWALMessage
err = tmjson.Unmarshal(msgJSON, &msg)
if err != nil {
panic(fmt.Errorf("failed to unmarshal json: %v", err))
panic(fmt.Errorf("failed to unmarshal json: %w", err))
}
err = dec.Encode(&msg)
if err != nil {
panic(fmt.Errorf("failed to encode msg: %v", err))
panic(fmt.Errorf("failed to encode msg: %w", err))
}
}
}
+3 -3
View File
@@ -24,7 +24,7 @@ func main() {
f, err := os.Open(os.Args[1])
if err != nil {
panic(fmt.Errorf("failed to open WAL file: %v", err))
panic(fmt.Errorf("failed to open WAL file: %w", err))
}
defer f.Close()
@@ -34,12 +34,12 @@ func main() {
if err == io.EOF {
break
} else if err != nil {
panic(fmt.Errorf("failed to decode msg: %v", err))
panic(fmt.Errorf("failed to decode msg: %w", err))
}
json, err := tmjson.Marshal(msg)
if err != nil {
panic(fmt.Errorf("failed to marshal msg: %v", err))
panic(fmt.Errorf("failed to marshal msg: %w", err))
}
_, err = os.Stdout.Write(json)