From b773b88dfb2d187ef71eb714b7f3a215e09b28a7 Mon Sep 17 00:00:00 2001 From: my-git9 Date: Mon, 25 Jul 2022 12:51:50 +0800 Subject: [PATCH] [internal/aws/k8s/k8sclient]Enable gocritic (#12666) Enable gocritic in internal/aws/k8s/k8sclient Signed-off-by: xin.li --- internal/aws/k8s/k8sclient/clientset.go | 3 +-- internal/aws/k8s/k8sclient/endpoint.go | 5 ++--- internal/aws/k8s/k8sclient/endpoint_info.go | 5 ++--- internal/aws/k8s/k8sclient/helpers_test.go | 3 +-- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/internal/aws/k8s/k8sclient/clientset.go b/internal/aws/k8s/k8sclient/clientset.go index 8bcfbd3b86c8..5ea3aa285773 100644 --- a/internal/aws/k8s/k8sclient/clientset.go +++ b/internal/aws/k8s/k8sclient/clientset.go @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -// nolint:gocritic package k8sclient // import "github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/k8s/k8sclient" import ( @@ -134,7 +133,7 @@ func Get(logger *zap.Logger, options ...Option) *K8sClient { mu.Lock() if optionsToK8sClient[strOptions] == nil { - //construct the k8s client + // construct the k8s client k8sClient := new(K8sClient) err := k8sClient.init(logger, options...) if err == nil { diff --git a/internal/aws/k8s/k8sclient/endpoint.go b/internal/aws/k8s/k8sclient/endpoint.go index ee6f4bce98cc..7b486397e3fb 100644 --- a/internal/aws/k8s/k8sclient/endpoint.go +++ b/internal/aws/k8s/k8sclient/endpoint.go @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -// nolint:gocritic package k8sclient // import "github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/k8s/k8sclient" import ( @@ -69,7 +68,7 @@ type epClient struct { mu sync.RWMutex podKeyToServiceNamesMap map[string][]string - serviceToPodNumMap map[Service]int //only running pods will show behind endpoints + serviceToPodNumMap map[Service]int // only running pods will show behind endpoints } func (c *epClient) PodKeyToServiceNames() map[string][]string { @@ -96,7 +95,7 @@ func (c *epClient) refresh() { objsList := c.store.List() - tmpMap := make(map[string]map[string]struct{}) //pod key to service names + tmpMap := make(map[string]map[string]struct{}) // pod key to service names serviceToPodNumMapNew := make(map[Service]int) for _, obj := range objsList { diff --git a/internal/aws/k8s/k8sclient/endpoint_info.go b/internal/aws/k8s/k8sclient/endpoint_info.go index b56d1c67167a..4dbbe0d8932f 100644 --- a/internal/aws/k8s/k8sclient/endpoint_info.go +++ b/internal/aws/k8s/k8sclient/endpoint_info.go @@ -12,11 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -// nolint:gocritic package k8sclient // import "github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/k8s/k8sclient" type endpointInfo struct { - name string //service name - namespace string //namespace name + name string // service name + namespace string // namespace name podKeyList []string } diff --git a/internal/aws/k8s/k8sclient/helpers_test.go b/internal/aws/k8s/k8sclient/helpers_test.go index 84a3d90a4a44..135073dc6cf8 100644 --- a/internal/aws/k8s/k8sclient/helpers_test.go +++ b/internal/aws/k8s/k8sclient/helpers_test.go @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -// nolint:gocritic package k8sclient import ( @@ -70,7 +69,7 @@ users: if err := ioutil.WriteFile(tmpfile.Name(), []byte(content), 0600); err != nil { t.Error(err) } - //overwrite the default kube config path + // overwrite the default kube config path kubeConfigPath = tmpfile.Name() return kubeConfigPath }