code refactor

This commit is contained in:
Ulric Qin 2022-06-09 19:01:15 +08:00
parent e2640c083b
commit 78d2ff6ec1
2 changed files with 3 additions and 4 deletions

View File

@ -2,7 +2,6 @@ package nginx_upstream_check
import (
"encoding/json"
"errors"
"fmt"
"io"
"log"
@ -113,7 +112,7 @@ func (ins *Instance) Init() error {
}
if len(ins.Targets) == 0 {
return errors.New("nginx_upstream_check targets empty")
return types.ErrInstancesEmpty
}
client, err := ins.createHTTPClient()

View File

@ -1,12 +1,12 @@
package ntp
import (
"errors"
"log"
"time"
"flashcat.cloud/categraf/config"
"flashcat.cloud/categraf/inputs"
"flashcat.cloud/categraf/types"
"github.com/toolkits/pkg/container/list"
"github.com/toolkits/pkg/nux"
)
@ -33,7 +33,7 @@ func (n *NTPStat) Drop() {}
func (n *NTPStat) Init() error {
if len(n.NTPServers) == 0 {
return errors.New("ntp servers empty")
return types.ErrInstancesEmpty
}
return nil
}