diff --git a/libnetwork/networkdb/delegate.go b/libnetwork/networkdb/delegate.go index 6083031f5a..74abdfe6f6 100644 --- a/libnetwork/networkdb/delegate.go +++ b/libnetwork/networkdb/delegate.go @@ -215,7 +215,7 @@ func (nDB *NetworkDB) handleTableEvent(tEvent *TableEvent, isBulkSync bool) bool // most likely the cluster is already aware of it // This also reduce the possibility that deletion of entries close to their garbage collection ends up circuling around // forever - //log.G(ctx).Infof("exiting on delete not knowing the obj with rebroadcast:%t", network.inSync) + // log.G(ctx).Infof("exiting on delete not knowing the obj with rebroadcast:%t", network.inSync) return network.inSync && e.reapTime > nDB.config.reapEntryInterval/6 } @@ -491,5 +491,4 @@ func (d *delegate) MergeRemoteState(buf []byte, isJoin bool) { d.nDB.handleNetworkEvent(nEvent) } - } diff --git a/libnetwork/networkdb/networkdb.go b/libnetwork/networkdb/networkdb.go index a7feafc7d6..d83f57375b 100644 --- a/libnetwork/networkdb/networkdb.go +++ b/libnetwork/networkdb/networkdb.go @@ -294,7 +294,7 @@ func (nDB *NetworkDB) Close() { log.G(context.TODO()).Errorf("%v(%v) Could not close DB: %v", nDB.config.Hostname, nDB.config.NodeID, err) } - //Avoid (*Broadcaster).run goroutine leak + // Avoid (*Broadcaster).run goroutine leak nDB.broadcaster.Close() } @@ -622,7 +622,7 @@ func (nDB *NetworkDB) JoinNetwork(nid string) error { nodeNetworks[nid].entriesNumber.Store(entries) nodeNetworks[nid].tableBroadcasts = &memberlist.TransmitLimitedQueue{ NumNodes: func() int { - //TODO fcrisciani this can be optimized maybe avoiding the lock? + // TODO fcrisciani this can be optimized maybe avoiding the lock? // this call is done each GetBroadcasts call to evaluate the number of // replicas for the message nDB.RLock() diff --git a/libnetwork/networkdb/networkdb_test.go b/libnetwork/networkdb/networkdb_test.go index 920c47ee62..48b559c07f 100644 --- a/libnetwork/networkdb/networkdb_test.go +++ b/libnetwork/networkdb/networkdb_test.go @@ -23,7 +23,7 @@ import ( var dbPort int32 = 10000 func TestMain(m *testing.M) { - os.WriteFile("/proc/sys/net/ipv6/conf/lo/disable_ipv6", []byte{'0', '\n'}, 0644) + os.WriteFile("/proc/sys/net/ipv6/conf/lo/disable_ipv6", []byte{'0', '\n'}, 0o644) logrus.SetLevel(logrus.ErrorLevel) os.Exit(m.Run()) } @@ -851,9 +851,11 @@ func TestNetworkDBIslands(t *testing.T) { node := dbs[0].nodes[dbs[0].config.NodeID] baseIPStr := node.Addr.String() // Node 0,1,2 are going to be the 3 bootstrap nodes - members := []string{fmt.Sprintf("%s:%d", baseIPStr, dbs[0].config.BindPort), + members := []string{ + fmt.Sprintf("%s:%d", baseIPStr, dbs[0].config.BindPort), fmt.Sprintf("%s:%d", baseIPStr, dbs[1].config.BindPort), - fmt.Sprintf("%s:%d", baseIPStr, dbs[2].config.BindPort)} + fmt.Sprintf("%s:%d", baseIPStr, dbs[2].config.BindPort), + } // Rejoining will update the list of the bootstrap members for i := 3; i < 5; i++ { t.Logf("Re-joining: %d", i) diff --git a/libnetwork/networkdb/networkdbdiagnostic.go b/libnetwork/networkdb/networkdbdiagnostic.go index c673bbbb92..5d59a3f36e 100644 --- a/libnetwork/networkdb/networkdbdiagnostic.go +++ b/libnetwork/networkdb/networkdbdiagnostic.go @@ -391,7 +391,7 @@ func dbGetTable(ctx interface{}, w http.ResponseWriter, r *http.Request) { if ok { table := nDB.GetTableByNetwork(tname, nid) rsp := &diagnostic.TableObj{Length: len(table)} - var i = 0 + i := 0 for k, v := range table { var encodedValue string if unsafe {