Skip to content

Commit

Permalink
code refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
UlricQin committed Jun 9, 2022
1 parent e2640c0 commit 78d2ff6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions inputs/nginx_upstream_check/nginx_upstream_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package nginx_upstream_check

import (
"encoding/json"
"errors"
"fmt"
"io"
"log"
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions inputs/ntp/ntp.go
Original file line number Diff line number Diff line change
@@ -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"
)
Expand All @@ -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
}
Expand Down

0 comments on commit 78d2ff6

Please sign in to comment.