Skip to content

Commit

Permalink
[internal/aws/k8s/k8sclient]Enable gocritic (#12666)
Browse files Browse the repository at this point in the history
Enable gocritic in internal/aws/k8s/k8sclient

Signed-off-by: xin.li <xin.li@daocloud.io>
  • Loading branch information
my-git9 authored Jul 25, 2022
1 parent 9af78b5 commit b773b88
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
3 changes: 1 addition & 2 deletions internal/aws/k8s/k8sclient/clientset.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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 {
Expand Down
5 changes: 2 additions & 3 deletions internal/aws/k8s/k8sclient/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
5 changes: 2 additions & 3 deletions internal/aws/k8s/k8sclient/endpoint_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
3 changes: 1 addition & 2 deletions internal/aws/k8s/k8sclient/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// nolint:gocritic
package k8sclient

import (
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit b773b88

Please sign in to comment.