添加golangci-lint配置

This commit is contained in:
刘祥超
2023-08-08 18:36:24 +08:00
parent 6de2834a8c
commit 977a12843c
5 changed files with 85 additions and 4 deletions

View File

@@ -201,7 +201,7 @@ func (this *CustomHTTPProvider) post(params maps.Map) (respData []byte, err erro
defer func() {
_ = resp.Body.Close()
}()
if resp.StatusCode != 200 {
if resp.StatusCode != http.StatusOK {
return nil, errors.New("status should be 200, but got '" + strconv.Itoa(resp.StatusCode) + "'")
}
return io.ReadAll(resp.Body)

View File

@@ -435,6 +435,11 @@ func (this *EdgeDNSAPIProvider) doAPI(path string, params map[string]any, respPt
if err != nil {
return err
}
defer func() {
if resp.Body != nil {
_ = resp.Body.Close()
}
}()
if resp.StatusCode != http.StatusOK {
return errors.New("invalid response status code '" + types.String(resp.StatusCode) + "'")