Fix linting errors
This commit is contained in:
parent
1cd56f1525
commit
558d0f4929
@ -47,7 +47,9 @@ func (n *NotifyBus) ServerInfo() (*NotifyServerInfo, error) {
|
||||
}
|
||||
|
||||
srvInfo := &NotifyServerInfo{}
|
||||
call.Store(&srvInfo.Name, &srvInfo.Vendor, &srvInfo.Version, &srvInfo.SpecVersion)
|
||||
if err := call.Store(&srvInfo.Name, &srvInfo.Vendor, &srvInfo.Version, &srvInfo.SpecVersion); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return srvInfo, nil
|
||||
}
|
||||
|
||||
@ -70,7 +72,9 @@ func (n *NotifyBus) Notify(notification BusNotification) (uint32, error) {
|
||||
return ret, call.Err
|
||||
}
|
||||
|
||||
call.Store(&ret)
|
||||
if err := call.Store(&ret); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return ret, nil
|
||||
}
|
||||
|
2
main.go
2
main.go
@ -147,7 +147,7 @@ func main() {
|
||||
fmt.Printf("Error connecting to NATS: %s\n", err)
|
||||
return cli.Exit(err, 1)
|
||||
}
|
||||
defer nc.Drain()
|
||||
defer nc.Drain() // nolint: errcheck
|
||||
|
||||
data, err := json.Marshal(bn)
|
||||
if err != nil {
|
||||
|
@ -23,8 +23,8 @@ func New(nc *nats.Conn, b *bus.NotifyBus) (*Server, error) {
|
||||
return &Server{conn: nc, Subject: DefaultSubject, bus: b}, nil
|
||||
}
|
||||
|
||||
func (s *Server) Close() {
|
||||
s.conn.Drain()
|
||||
func (s *Server) Close() error {
|
||||
return s.conn.Drain()
|
||||
}
|
||||
|
||||
func (s *Server) Start() error {
|
||||
@ -59,14 +59,18 @@ func (s *Server) Start() error {
|
||||
|
||||
if err := json.Unmarshal(msg.Data(), &bn); err != nil {
|
||||
slog.Warn("Error unmarshalling message", "error", err)
|
||||
msg.TermWithReason("failed to decode json")
|
||||
if err := msg.TermWithReason("failed to decode json"); err != nil {
|
||||
slog.Error("Error terminating message", "error", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
id, err := s.bus.Notify(bn)
|
||||
if err != nil {
|
||||
slog.Warn("Error sending notification", "error", err)
|
||||
msg.NakWithDelay(1 * time.Minute)
|
||||
if err := msg.NakWithDelay(1 * time.Minute); err != nil {
|
||||
slog.Error("Error naking message", "error", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
slog.Info("Sent notification", "id", id)
|
||||
|
Loading…
x
Reference in New Issue
Block a user