mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2026-05-11 03:55:39 +08:00
添加golangci-lint配置
This commit is contained in:
@@ -160,7 +160,7 @@ func (this *SysLockerDAO) Increase(tx *dbs.Tx, key string, defaultValue int64) (
|
||||
colValue, err := tx.FindCol(0, "INSERT INTO `"+this.Table+"` (`key`, `version`) VALUES ('"+key+"', "+types.String(defaultValue+sysLockerStep)+") ON DUPLICATE KEY UPDATE `version`=`version`+"+types.String(sysLockerStep)+"; SELECT `version` FROM `"+this.Table+"` WHERE `key`='"+key+"'")
|
||||
if err != nil {
|
||||
if CheckSQLErrCode(err, 1064 /** syntax error **/) {
|
||||
// continue to use seperated query
|
||||
// continue to use separated query
|
||||
err = nil
|
||||
} else {
|
||||
return 0, err
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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) + "'")
|
||||
|
||||
@@ -13,9 +13,9 @@ func (this *DetailedError) Code() string {
|
||||
return this.code
|
||||
}
|
||||
|
||||
func NewDetailedError(code string, error string) *DetailedError {
|
||||
func NewDetailedError(code string, errString string) *DetailedError {
|
||||
return &DetailedError{
|
||||
msg: error,
|
||||
msg: errString,
|
||||
code: code,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user