Skip to content

Commit

Permalink
Make linters happy
Browse files Browse the repository at this point in the history
  • Loading branch information
mkuratczyk committed Feb 23, 2024
1 parent 6ac48db commit b2c348b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ func main() {
log.Error("can't create omq-memory.pprof", "error", err)
}
_ = pprof.WriteHeapProfile(memFile)
defer memFile.Close()
defer func() { _ = memFile.Close() }()
}
}
2 changes: 1 addition & 1 deletion pkg/amqp10_client/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,5 +150,5 @@ func (p Amqp10Publisher) Send() {

func (p Amqp10Publisher) Stop(reason string) {
log.Debug("closing connection", "protocol", "amqp-1.0", "publisherId", p.Id, "reason", reason)
p.Connectionection.Close()
_ = p.Connectionection.Close()
}
16 changes: 8 additions & 8 deletions pkg/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,47 +31,47 @@ func NewPublisher(protocol Protocol, cfg config.Config, id int) (Publisher, erro
case AMQP:
p := amqp10_client.NewPublisher(cfg, id)
if p == nil {
return nil, fmt.Errorf("Failed to create an AMQP-1.0 publisher")
return nil, fmt.Errorf("failed to create an AMQP-1.0 publisher")
}
return p, nil
case STOMP:
p := stomp_client.NewPublisher(cfg, id)
if p == nil {
return nil, fmt.Errorf("Failed to create a STOMP publisher")
return nil, fmt.Errorf("failed to create a STOMP publisher")
}
return p, nil
case MQTT:
p := mqtt_client.NewPublisher(cfg, id)
if p == nil {
return nil, fmt.Errorf("Failed to create an MQTT publisher")
return nil, fmt.Errorf("failed to create an MQTT publisher")
}
return p, nil
}

return nil, fmt.Errorf("Unknown protocol")
return nil, fmt.Errorf("unknown protocol")
}

func NewConsumer(protocol Protocol, cfg config.Config, id int) (Consumer, error) {
switch protocol {
case AMQP:
c := amqp10_client.NewConsumer(cfg, id)
if c == nil {
return nil, fmt.Errorf("Failed to create an AMQP-1.0 consumer")
return nil, fmt.Errorf("failed to create an AMQP-1.0 consumer")
}
return c, nil
case STOMP:
c := stomp_client.NewConsumer(cfg, id)
if c == nil {
return nil, fmt.Errorf("Failed to create an AMQP-1.0 consumer")
return nil, fmt.Errorf("failed to create an AMQP-1.0 consumer")
}
return c, nil
case MQTT:
c := mqtt_client.NewConsumer(cfg, id)
if c == nil {
return nil, fmt.Errorf("Failed to create an AMQP-1.0 consumer")
return nil, fmt.Errorf("failed to create an AMQP-1.0 consumer")
}
return c, nil
}

return nil, fmt.Errorf("Unknown protocol")
return nil, fmt.Errorf("unknown protocol")
}
2 changes: 1 addition & 1 deletion pkg/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (m MetricsServer) PrintMetrics() {
log.Error("Error getting metrics", "error", err)
return
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()

body, err := io.ReadAll(resp.Body)
if err != nil {
Expand Down

0 comments on commit b2c348b

Please sign in to comment.