Skip to content

Commit 39358f7

Browse files
committed
container/(docker|podman): rename var that shadowed import
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 2bf8c67 commit 39358f7

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

container/docker/handler.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,11 +356,11 @@ func (h *containerHandler) GetCgroupPath(resource string) (string, error) {
356356
if !cgroups.IsCgroup2UnifiedMode() {
357357
res = resource
358358
}
359-
path, ok := h.cgroupPaths[res]
359+
cgroupPath, ok := h.cgroupPaths[res]
360360
if !ok {
361361
return "", fmt.Errorf("could not find path for resource %q for container %q", resource, h.reference.Name)
362362
}
363-
return path, nil
363+
return cgroupPath, nil
364364
}
365365

366366
func (h *containerHandler) GetContainerLabels() map[string]string {

container/podman/handler.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,12 @@ func newContainerHandler(
163163
// This happens in cases such as kubernetes where the containers doesn't have an IP address itself and we need to use the pod's address
164164
networkMode := string(handler.networkMode)
165165
if handler.ipAddress == "" && strings.HasPrefix(networkMode, "container:") {
166-
id := strings.TrimPrefix(networkMode, "container:")
167-
ctnr, err := InspectContainer(id)
166+
containerID := strings.TrimPrefix(networkMode, "container:")
167+
c, err := InspectContainer(containerID)
168168
if err != nil {
169169
return nil, err
170170
}
171-
handler.ipAddress = ctnr.NetworkSettings.IPAddress
171+
handler.ipAddress = c.NetworkSettings.IPAddress
172172
}
173173

174174
if metrics.Has(container.DiskUsageMetrics) {
@@ -272,12 +272,12 @@ func (h *containerHandler) GetCgroupPath(resource string) (string, error) {
272272
if !cgroups.IsCgroup2UnifiedMode() {
273273
res = resource
274274
}
275-
path, ok := h.cgroupPaths[res]
275+
cgroupPath, ok := h.cgroupPaths[res]
276276
if !ok {
277277
return "", fmt.Errorf("couldn't find path for resource %q for container %q", resource, h.reference.Name)
278278
}
279279

280-
return path, nil
280+
return cgroupPath, nil
281281
}
282282

283283
func (h *containerHandler) GetContainerLabels() map[string]string {

0 commit comments

Comments
 (0)