Skip to content

Commit

Permalink
chore: fix golang warnings
Browse files Browse the repository at this point in the history
- using io instead of io/ioutils
- add field name to Struct literal at FinishRequest
- using for {} instead of for true {}
- add missing formmating directive for fmt.Errorf
  • Loading branch information
endersonmaia committed Sep 10, 2024
1 parent 9d7eb8f commit f50f90c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions go/src/dapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"io"
"log"
"os"
"strconv"
Expand Down Expand Up @@ -41,23 +41,23 @@ func Handler(response *rollups.FinishResponse) error {
case "advance_state":
data := new(rollups.AdvanceResponse)
if err = json.Unmarshal(response.Data, data); err != nil {
return fmt.Errorf("Handler: Error unmarshaling advance:", err)
return fmt.Errorf("Handler: Error unmarshaling advance: %s", err)
}
err = HandleAdvance(data)
case "inspect_state":
data := new(rollups.InspectResponse)
if err = json.Unmarshal(response.Data, data); err != nil {
return fmt.Errorf("Handler: Error unmarshaling inspect:", err)
return fmt.Errorf("Handler: Error unmarshaling inspect: %s", err)
}
err = HandleInspect(data)
}
return err
}

func main() {
finish := rollups.FinishRequest{"accept"}
finish := rollups.FinishRequest{Status: "accept"}

for true {
for {
infolog.Println("Sending finish")
res, err := rollups.SendFinish(&finish)
if err != nil {
Expand All @@ -69,7 +69,7 @@ func main() {
infolog.Println("No pending rollup request, trying again")
} else {

resBody, err := ioutil.ReadAll(res.Body)
resBody, err := io.ReadAll(res.Body)
if err != nil {
errlog.Panicln("Error: could not read response body: ", err)
}
Expand Down

0 comments on commit f50f90c

Please sign in to comment.