Format Receivers

This commit is contained in:
Thomas Roehl 2021-05-18 15:44:42 +02:00
parent 7106e465ad
commit f3697b9991
2 changed files with 3 additions and 3 deletions

View File

@ -14,7 +14,7 @@ type ReceiverConfig struct {
} }
type Receiver struct { type Receiver struct {
name string name string
addr string addr string
port string port string
database string database string

View File

@ -1,12 +1,12 @@
package receivers package receivers
import ( import (
"errors"
s "github.com/ClusterCockpit/cc-metric-collector/sinks" s "github.com/ClusterCockpit/cc-metric-collector/sinks"
protocol "github.com/influxdata/line-protocol" protocol "github.com/influxdata/line-protocol"
nats "github.com/nats-io/nats.go" nats "github.com/nats-io/nats.go"
"log" "log"
"time" "time"
"errors"
) )
type NatsReceiver struct { type NatsReceiver struct {
@ -19,7 +19,7 @@ var DefaultTime = func() time.Time {
} }
func (r *NatsReceiver) Init(config ReceiverConfig, sink s.SinkFuncs) error { func (r *NatsReceiver) Init(config ReceiverConfig, sink s.SinkFuncs) error {
if len(config.Addr) == 0 || if len(config.Addr) == 0 ||
len(config.Port) == 0 || len(config.Port) == 0 ||
len(config.Database) == 0 { len(config.Database) == 0 {
return errors.New("Not all configuration variables set required by NatsReceiver") return errors.New("Not all configuration variables set required by NatsReceiver")