Skip to content

Commit 0613803

Browse files
committed
address linter issues
1 parent d341612 commit 0613803

File tree

7 files changed

+13
-10
lines changed

7 files changed

+13
-10
lines changed

cni/network/network.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
"github.com/Azure/azure-container-networking/cni"
1616
"github.com/Azure/azure-container-networking/cni/api"
1717
"github.com/Azure/azure-container-networking/cni/log"
18-
"github.com/Azure/azure-container-networking/cni/telemetry/client"
18+
telemetryclient "github.com/Azure/azure-container-networking/cni/telemetry/client"
1919
"github.com/Azure/azure-container-networking/cni/util"
2020
"github.com/Azure/azure-container-networking/cns"
2121
cnscli "github.com/Azure/azure-container-networking/cns/client"
@@ -294,7 +294,7 @@ func (plugin *NetPlugin) getPodInfo(args string) (name, ns string, err error) {
294294
return k8sPodName, k8sNamespace, nil
295295
}
296296

297-
func (plugin *NetPlugin) setCNIReportDetails(containerID string, opType, msg string) {
297+
func (plugin *NetPlugin) setCNIReportDetails(containerID, opType, msg string) {
298298
telemetry.CNIReportSettings.OperationType = opType
299299
telemetry.CNIReportSettings.SubContext = containerID
300300
telemetry.CNIReportSettings.EventMessage = msg
@@ -1095,7 +1095,7 @@ func (plugin *NetPlugin) Delete(args *cniSkel.CmdArgs) error {
10951095

10961096
logger.Warn("Release ip by ContainerID (endpoint not found)",
10971097
zap.String("containerID", args.ContainerID))
1098-
telemetry.SendEvent(fmt.Sprintf("Release ip by ContainerID (endpoint not found): %s", args.ContainerID))
1098+
telemetry.SendEvent("Release ip by ContainerID (endpoint not found): " + args.ContainerID)
10991099
if err = plugin.ipamInvoker.Delete(nil, nwCfg, args, nwInfo.Options); err != nil {
11001100
return plugin.RetriableError(fmt.Errorf("failed to release address(no endpoint): %w", err))
11011101
}

cni/network/plugin/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"github.com/Azure/azure-container-networking/cni/api"
1515
zaplog "github.com/Azure/azure-container-networking/cni/log"
1616
"github.com/Azure/azure-container-networking/cni/network"
17-
"github.com/Azure/azure-container-networking/cni/telemetry/client"
17+
telemetryclient "github.com/Azure/azure-container-networking/cni/telemetry/client"
1818
"github.com/Azure/azure-container-networking/common"
1919
"github.com/Azure/azure-container-networking/nns"
2020
"github.com/Azure/azure-container-networking/platform"

cni/network/stateless/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/Azure/azure-container-networking/cni/api"
1414
zapLog "github.com/Azure/azure-container-networking/cni/log"
1515
"github.com/Azure/azure-container-networking/cni/network"
16-
"github.com/Azure/azure-container-networking/cni/telemetry/client"
16+
telemetryclient "github.com/Azure/azure-container-networking/cni/telemetry/client"
1717
"github.com/Azure/azure-container-networking/common"
1818
"github.com/Azure/azure-container-networking/log"
1919
"github.com/Azure/azure-container-networking/nns"

cni/telemetry/client/telemetry_client.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,25 @@ func (c *TelemetryClient) DisconnectTelemetry() {
4747
}
4848
c.tb.Close()
4949
}
50+
5051
func (c *TelemetryClient) sendTelemetry(msg string) {
5152
if c.tb == nil {
5253
return
5354
}
5455
c.lock.Lock()
5556
defer c.lock.Unlock()
56-
c.CNIReportSettings.EventMessage = msg
5757
eventMsg := fmt.Sprintf("[%d] %s", os.Getpid(), msg)
5858
c.CNIReportSettings.EventMessage = eventMsg
5959
telemetry.SendCNIEvent(c.tb, c.CNIReportSettings)
6060
}
61+
6162
func (c *TelemetryClient) sendLog(msg string) {
6263
if c.logger == nil {
6364
return
6465
}
6566
c.logger.Info("Telemetry Event", zap.String("message", msg))
6667
}
68+
6769
func (c *TelemetryClient) SendEvent(msg string) {
6870
c.sendLog(msg)
6971
c.sendTelemetry(msg)

network/endpoint.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"strings"
1111

1212
"github.com/Azure/azure-container-networking/cni/log"
13-
"github.com/Azure/azure-container-networking/cni/telemetry/client"
13+
telemetryclient "github.com/Azure/azure-container-networking/cni/telemetry/client"
1414
"github.com/Azure/azure-container-networking/cns"
1515
"github.com/Azure/azure-container-networking/netio"
1616
"github.com/Azure/azure-container-networking/netlink"
@@ -165,7 +165,8 @@ func FormatStructPointers[T any](slice []*T) string {
165165
}
166166

167167
func (epInfo *EndpointInfo) PrettyString() string {
168-
return fmt.Sprintf("Id:%s ContainerID:%s NetNsPath:%s IfName:%s IfIndex:%d MacAddr:%s IPAddrs:%v Gateways:%v Data:%+v NICType: %s NetworkContainerID: %s HostIfName: %s NetNs: %s Options: %v MasterIfName: %s IfName: %s HNSEndpointID: %s HNSNetworkID: %s",
168+
return fmt.Sprintf("Id:%s ContainerID:%s NetNsPath:%s IfName:%s IfIndex:%d MacAddr:%s IPAddrs:%v Gateways:%v Data:%+v NICType: %s "+
169+
"NetworkContainerID: %s HostIfName: %s NetNs: %s Options: %v MasterIfName: %s IfName: %s HNSEndpointID: %s HNSNetworkID: %s",
169170
epInfo.EndpointID, epInfo.ContainerID, epInfo.NetNsPath, epInfo.IfName, epInfo.IfIndex, epInfo.MacAddress.String(), epInfo.IPAddresses,
170171
epInfo.Gateways, epInfo.Data, epInfo.NICType, epInfo.NetworkContainerID, epInfo.HostIfName, epInfo.NetNs, epInfo.Options, epInfo.MasterIfName,
171172
epInfo.IfName, epInfo.HNSEndpointID, epInfo.HNSNetworkID)

network/endpoint_windows.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ func (nw *network) deleteEndpointImplHnsV2(ep *endpoint) error {
580580
}
581581

582582
logger.Info("Deleting hcn endpoint with id", zap.String("HnsId", ep.HnsId))
583-
telemetry.SendEvent(fmt.Sprintf("Deleting HCN endpoint: %s", ep.HnsId))
583+
telemetry.SendEvent("Deleting HCN endpoint: " + ep.HnsId)
584584

585585
hcnEndpoint, err = Hnsv2.GetEndpointByID(ep.HnsId)
586586
if err != nil {

network/network_windows.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ func (nm *networkManager) deleteNetworkImplHnsV2(nw *network) error {
476476
var hcnNetwork *hcn.HostComputeNetwork
477477
var err error
478478
logger.Info("Deleting hcn network with id", zap.String("id", nw.HnsId))
479-
telemetry.SendEvent(fmt.Sprintf("Deleting HCN network: %s", nw.HnsId))
479+
telemetry.SendEvent("Deleting HCN network: " + nw.HnsId)
480480

481481
if hcnNetwork, err = Hnsv2.GetNetworkByID(nw.HnsId); err != nil {
482482
return fmt.Errorf("Failed to get hcn network with id: %s due to err: %v", nw.HnsId, err)

0 commit comments

Comments
 (0)