fix: fix all lint warning in pkg (#1263)

* fix:fix lint errors in internal

* fix:fix lint error in interal/tools

* fix: fix lint errros  in pkg/statics

* fix: fix lint erros in pkg/authverify,pkg/rpcclien

* fix: fix lint erros in pkg/common/cmd

* fix: fix lint erros in pkg/common/config,convert

* fix: fix lint erros in pkg/common/db/cache

* fix: fix lint errors in pkg/common/db/controller

* fix:fix lint errors in pkg/common/db/relation
and pkg/common/db/localcache

* fix: fix rest lint errors in pkg/common/db

* fix: fix rest lint errors in pkg

* fix:set back go.work to use go 1.19
This commit is contained in:
CNCSMonster
2023-10-23 16:24:55 +08:00
committed by GitHub
parent ba190fde13
commit b1415473ff
91 changed files with 1617 additions and 855 deletions
+16 -4
View File
@@ -34,16 +34,21 @@ import (
var client http.Client
func Get(url string) (response []byte, err error) {
client := http.Client{Timeout: 5 * time.Second}
resp, err := client.Get(url)
clientGet := http.Client{Timeout: 5 * time.Second}
req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, url, nil)
if err != nil {
return nil, err
}
resp, err2 := clientGet.Do(req)
if err2 != nil {
return nil, err
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
body, err3 := io.ReadAll(resp.Body)
if err3 != nil {
return nil, err
}
return body, nil
}
@@ -83,6 +88,7 @@ func Post(
if err != nil {
return nil, err
}
return result, nil
}
@@ -98,6 +104,7 @@ func PostReturn(
return err
}
err = json.Unmarshal(b, output)
return err
}
@@ -116,17 +123,22 @@ func callBackPostReturn(
if err != nil {
if callbackConfig.CallbackFailedContinue != nil && *callbackConfig.CallbackFailedContinue {
log.ZWarn(ctx, "callback failed but continue", err, "url", url)
return errs.ErrCallbackContinue
}
return errs.ErrNetwork.Wrap(err.Error())
}
if err = json.Unmarshal(b, output); err != nil {
if callbackConfig.CallbackFailedContinue != nil && *callbackConfig.CallbackFailedContinue {
log.ZWarn(ctx, "callback failed but continue", err, "url", url)
return errs.ErrCallbackContinue
}
return errs.ErrData.Wrap(err.Error())
}
return output.Parse()
}