Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update ioutil func&pruning case #39798

Merged
merged 3 commits into from
Dec 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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