linting fixes

This commit is contained in:
0xdcarns
2022-01-03 18:27:13 -05:00
committed by Matthew R Kasun
parent c7dc874bb8
commit 4bc28e455a

View File

@@ -21,6 +21,7 @@ func Daemon() error {
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
networks, err := ncutils.GetSystemNetworks() networks, err := ncutils.GetSystemNetworks()
if err != nil { if err != nil {
cancel()
return err return err
} }
for _, network := range networks { for _, network := range networks {
@@ -55,7 +56,7 @@ func Netclient(ctx context.Context, network string) {
cfg.ReadConfig() cfg.ReadConfig()
//fix NodeID to remove ### so NodeID can be used as message topic //fix NodeID to remove ### so NodeID can be used as message topic
//remove with GRA-73 //remove with GRA-73
cfg.Node.ID = strings.ReplaceAll(cfg.Node.ID, "###", "-") cfg.Node.ID = strings.Replace(cfg.Node.ID, "###", "-", 1)
ncutils.Log("daemon started for network:" + network) ncutils.Log("daemon started for network:" + network)
client := SetupMQTT(cfg) client := SetupMQTT(cfg)
if token := client.Subscribe("#", 0, nil); token.Wait() && token.Error() != nil { if token := client.Subscribe("#", 0, nil); token.Wait() && token.Error() != nil {
@@ -69,8 +70,6 @@ func Netclient(ctx context.Context, network string) {
go Metrics(ctx, cfg, network) go Metrics(ctx, cfg, network)
<-ctx.Done() <-ctx.Done()
ncutils.Log("shutting down daemon") ncutils.Log("shutting down daemon")
return
ncutils.Log("netclient go routine ended for " + network)
} }
// All -- mqtt message hander for all ('#') topics // All -- mqtt message hander for all ('#') topics