From e2e5bf5e0b6071048c04eeb135dafd705160da66 Mon Sep 17 00:00:00 2001 From: Guangwen Feng Date: Fri, 10 Jan 2020 16:55:07 +0800 Subject: [PATCH] Fix golint warning for pkg/util/procfs/procfs_linux.go Signed-off-by: Guangwen Feng --- pkg/util/procfs/procfs_linux.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pkg/util/procfs/procfs_linux.go b/pkg/util/procfs/procfs_linux.go index 46059c33e77..9a186f4fe98 100644 --- a/pkg/util/procfs/procfs_linux.go +++ b/pkg/util/procfs/procfs_linux.go @@ -36,8 +36,10 @@ import ( "k8s.io/klog" ) +// ProcFS provides a helper for getting container name via pid. type ProcFS struct{} +// NewProcFS returns a ProcFS object. func NewProcFS() ProcFSInterface { return &ProcFS{} } @@ -53,7 +55,7 @@ func containerNameFromProcCgroup(content string) (string, error) { return "", fmt.Errorf("could not find devices cgroup location") } -// getFullContainerName gets the container name given the root process id of the container. +// GetFullContainerName gets the container name given the root process id of the container. // E.g. if the devices cgroup for the container is stored in /sys/fs/cgroup/devices/docker/nginx, // return docker/nginx. Assumes that the process is part of exactly one cgroup hierarchy. func (pfs *ProcFS) GetFullContainerName(pid int) (string, error) { @@ -68,8 +70,8 @@ func (pfs *ProcFS) GetFullContainerName(pid int) (string, error) { return containerNameFromProcCgroup(string(content)) } -// Find process(es) using a regular expression and send a specified -// signal to each process +// PKill finds process(es) using a regular expression and send a specified +// signal to each process. func PKill(name string, sig syscall.Signal) error { if len(name) == 0 { return fmt.Errorf("name should not be empty") @@ -91,8 +93,8 @@ func PKill(name string, sig syscall.Signal) error { return utilerrors.NewAggregate(errList) } -// Find process(es) with a specified name (regexp match) -// and return their pid(s) +// PidOf finds process(es) with a specified name (regexp match) +// and return their pid(s). func PidOf(name string) ([]int, error) { if len(name) == 0 { return []int{}, fmt.Errorf("name should not be empty")