Skip to content

Commit

Permalink
update defer
Browse files Browse the repository at this point in the history
  • Loading branch information
cherry-yl-sh committed Jun 20, 2024
1 parent 56eb30a commit 1b208a3
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions common/price_compoent/price_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,8 @@ func GetPriceUsd(tokenType global_const.TokenType) (float64, error) {
bodystr := string(body)
strarr := strings.Split(bodystr, ":")
usdstr := strings.TrimRight(strarr[2], "}}")
err := res.Body.Close()
if err != nil {
logrus.Errorf("close body error: %v", err)
}
defer res.Body.Close()

return strconv.ParseFloat(usdstr, 64)
}

Expand Down

0 comments on commit 1b208a3

Please sign in to comment.