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

View File

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