Skip to content

Commit

Permalink
fix: correct lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
1995parham committed Dec 4, 2023
1 parent da3e3bb commit 86938d1
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
1 change: 1 addition & 0 deletions internal/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type Message struct {

// New creates a new mqtt client with given configuration.
// isSubscribe for ping message.
// nolint: funlen
func New(ctx context.Context,
cfg Config,
logger *zap.Logger,
Expand Down
18 changes: 9 additions & 9 deletions internal/client/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import (
)

type Config struct {
URL string `koanf:"url"`
ClientID string `koanf:"clientid"`
Username string `koanf:"username"`
Password string `koanf:"password"`
KeepAlive time.Duration `koanf:"keepalive"`
PingTimeout time.Duration `koanf:"ping_timeout"`
AutoReconnect bool `koanf:"auto_reconnect"`
QoS int `koanf:"qos"`
Retained bool `koanf:"retained"`
URL string `json:"url,omitempty" koanf:"url"`
ClientID string `json:"client_id,omitempty" koanf:"clientid"`
Username string `json:"username,omitempty" koanf:"username"`
Password string `json:"password,omitempty" koanf:"password"`
KeepAlive time.Duration `json:"keep_alive,omitempty" koanf:"keepalive"`
PingTimeout time.Duration `json:"ping_timeout,omitempty" koanf:"ping_timeout"`
AutoReconnect bool `json:"auto_reconnect,omitempty" koanf:"auto_reconnect"`
QoS int `json:"qo_s,omitempty" koanf:"qos"`
Retained bool `json:"retained,omitempty" koanf:"retained"`
}
1 change: 1 addition & 0 deletions internal/client/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ func NewMetrics() Metrics {
Help: "total number of received pongs",
ConstLabels: nil,
}),
// nolint: exhaustruct
PingDuration: newHistogram(prometheus.HistogramOpts{
Namespace: Namespace,
Subsystem: Subsystem,
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ func Execute() {
tracer := trace.New(cfg.Telemetry.Trace)
metric.NewServer(cfg.Telemetry.Metric).Start(logger.Named("metric"))

// nolint: exhaustivestruct
// nolint: exhaustruct
root := &cobra.Command{
Use: "mqtt-blackbox-exporter",
Short: "ping pong with mqtt broker",
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
main(cfg, logger, tracer)
},
}
Expand Down
1 change: 1 addition & 0 deletions internal/telemetry/metric/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func NewServer(cfg config.Metric) Server {
// nolint: gomnd
func (s Server) Start(logger *zap.Logger) {
go func() {
// nolint: exhaustruct
srv := http.Server{
Addr: s.address,
Handler: s.srv,
Expand Down

0 comments on commit 86938d1

Please sign in to comment.