Skip to content

Commit 2bf8c67

Browse files
committed
container/podman: containerhandler: use pointer-receiver
It's more idiomatic, and aligns with the docker implementation for the same. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 631443f commit 2bf8c67

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

container/podman/handler.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -212,19 +212,19 @@ func determineDeviceStorage(storageDriver docker.StorageDriver, storageDir strin
212212
}
213213
}
214214

215-
func (h containerHandler) ContainerReference() (info.ContainerReference, error) {
215+
func (h *containerHandler) ContainerReference() (info.ContainerReference, error) {
216216
return h.reference, nil
217217
}
218218

219-
func (h containerHandler) needNet() bool {
219+
func (h *containerHandler) needNet() bool {
220220
if h.metrics.Has(container.NetworkUsageMetrics) {
221221
h.networkMode.IsContainer()
222222
return !h.networkMode.IsContainer()
223223
}
224224
return false
225225
}
226226

227-
func (h containerHandler) GetSpec() (info.ContainerSpec, error) {
227+
func (h *containerHandler) GetSpec() (info.ContainerSpec, error) {
228228
hasFilesystem := h.metrics.Has(container.DiskUsageMetrics)
229229

230230
spec, err := common.GetSpec(h.cgroupPaths, h.machineInfoFactory, h.needNet(), hasFilesystem)
@@ -240,7 +240,7 @@ func (h containerHandler) GetSpec() (info.ContainerSpec, error) {
240240
return spec, nil
241241
}
242242

243-
func (h containerHandler) GetStats() (*info.ContainerStats, error) {
243+
func (h *containerHandler) GetStats() (*info.ContainerStats, error) {
244244
stats, err := h.libcontainerHandler.GetStats()
245245
if err != nil {
246246
return stats, err
@@ -259,15 +259,15 @@ func (h containerHandler) GetStats() (*info.ContainerStats, error) {
259259
return stats, nil
260260
}
261261

262-
func (h containerHandler) ListContainers(listType container.ListType) ([]info.ContainerReference, error) {
262+
func (h *containerHandler) ListContainers(listType container.ListType) ([]info.ContainerReference, error) {
263263
return []info.ContainerReference{}, nil
264264
}
265265

266-
func (h containerHandler) ListProcesses(listType container.ListType) ([]int, error) {
266+
func (h *containerHandler) ListProcesses(listType container.ListType) ([]int, error) {
267267
return h.libcontainerHandler.GetProcesses()
268268
}
269269

270-
func (h containerHandler) GetCgroupPath(resource string) (string, error) {
270+
func (h *containerHandler) GetCgroupPath(resource string) (string, error) {
271271
var res string
272272
if !cgroups.IsCgroup2UnifiedMode() {
273273
res = resource
@@ -280,30 +280,30 @@ func (h containerHandler) GetCgroupPath(resource string) (string, error) {
280280
return path, nil
281281
}
282282

283-
func (h containerHandler) GetContainerLabels() map[string]string {
283+
func (h *containerHandler) GetContainerLabels() map[string]string {
284284
return h.labels
285285
}
286286

287-
func (h containerHandler) GetContainerIPAddress() string {
287+
func (h *containerHandler) GetContainerIPAddress() string {
288288
return h.ipAddress
289289
}
290290

291-
func (h containerHandler) Exists() bool {
291+
func (h *containerHandler) Exists() bool {
292292
return common.CgroupExists(h.cgroupPaths)
293293
}
294294

295-
func (h containerHandler) Cleanup() {
295+
func (h *containerHandler) Cleanup() {
296296
if h.fsHandler != nil {
297297
h.fsHandler.Stop()
298298
}
299299
}
300300

301-
func (h containerHandler) Start() {
301+
func (h *containerHandler) Start() {
302302
if h.fsHandler != nil {
303303
h.fsHandler.Start()
304304
}
305305
}
306306

307-
func (h containerHandler) Type() container.ContainerType {
307+
func (h *containerHandler) Type() container.ContainerType {
308308
return container.ContainerTypePodman
309309
}

0 commit comments

Comments
 (0)