Skip to content

Commit

Permalink
fix: update ioutil func&pruning case (#39798)
Browse files Browse the repository at this point in the history
  • Loading branch information
songzhibin97 authored Dec 10, 2022
1 parent 1ff1342 commit 86fc600
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions util/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ var (
)

// GetRawInfo do what its name tells
// nolint:unused
func GetRawInfo(app string) string {
info := ""
info += fmt.Sprintf("App Name: %s\n", app)
Expand All @@ -43,6 +44,7 @@ func GetRawInfo(app string) string {
}

// PrintInfo prints the app's basic information in log
// nolint:unused
func PrintInfo(app string) {
log.Info("Welcome to "+app,
zap.String("Release Version", Version),
Expand Down
8 changes: 5 additions & 3 deletions util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net"
"net/http"
"strconv"
Expand Down Expand Up @@ -63,6 +63,8 @@ func StringsToInterfaces(strs []string) []interface{} {
// return errors.Trace(err)
// }
// fmt.Println(resp.IP)
//
// nolint:unused
func GetJSON(client *http.Client, url string, v interface{}) error {
resp, err := client.Get(url)
if err != nil {
Expand All @@ -71,7 +73,7 @@ func GetJSON(client *http.Client, url string, v interface{}) error {
defer resp.Body.Close()

if resp.StatusCode != http.StatusOK {
body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
return errors.Trace(err)
}
Expand Down Expand Up @@ -181,7 +183,7 @@ func GenLogFields(costTime time.Duration, info *ProcessInfo, needTruncateSQL boo
// PrintableASCII detects if b is a printable ASCII character.
// Ref to:http://facweb.cs.depaul.edu/sjost/it212/documents/ascii-pr.htm
func PrintableASCII(b byte) bool {
if b >= 0 && b < 32 || b > 127 {
if b < 32 || b > 127 {
return false
}

Expand Down

0 comments on commit 86fc600

Please sign in to comment.