Skip to content

Commit

Permalink
chore: Fix lint
Browse files Browse the repository at this point in the history
Signed-off-by: Manuel Rüger <manuel@rueg.eu>
  • Loading branch information
mrueg committed Jul 3, 2023
1 parent 29bc86b commit 221b395
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 20 deletions.
2 changes: 1 addition & 1 deletion internal/store/certificatesigningrequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func wrapCSRFunc(f func(*certv1.CertificateSigningRequest) *metric.Family) func(
}
}

func createCSRListWatch(kubeClient clientset.Interface, ns string, fieldSelector string) cache.ListerWatcher {
func createCSRListWatch(kubeClient clientset.Interface, _ string, fieldSelector string) cache.ListerWatcher {
return &cache.ListWatch{
ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) {
return kubeClient.CertificatesV1().CertificateSigningRequests().List(context.TODO(), opts)
Expand Down
2 changes: 1 addition & 1 deletion internal/store/clusterrole.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func clusterRoleMetricFamilies(allowAnnotationsList, allowLabelsList []string) [
}
}

func createClusterRoleListWatch(kubeClient clientset.Interface, ns string, fieldSelector string) cache.ListerWatcher {
func createClusterRoleListWatch(kubeClient clientset.Interface, _ string, fieldSelector string) cache.ListerWatcher {
return &cache.ListWatch{
ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) {
opts.FieldSelector = fieldSelector
Expand Down
2 changes: 1 addition & 1 deletion internal/store/clusterrolebinding.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func clusterRoleBindingMetricFamilies(allowAnnotationsList, allowLabelsList []st
}
}

func createClusterRoleBindingListWatch(kubeClient clientset.Interface, ns string, fieldSelector string) cache.ListerWatcher {
func createClusterRoleBindingListWatch(kubeClient clientset.Interface, _ string, fieldSelector string) cache.ListerWatcher {
return &cache.ListWatch{
ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) {
opts.FieldSelector = fieldSelector
Expand Down
2 changes: 2 additions & 0 deletions internal/store/endpointslice.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,11 @@ func wrapEndpointSliceFunc(f func(*discoveryv1.EndpointSlice) *metric.Family) fu
func createEndpointSliceListWatch(kubeClient clientset.Interface, ns string, fieldSelector string) cache.ListerWatcher {
return &cache.ListWatch{
ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) {
opts.FieldSelector = fieldSelector
return kubeClient.DiscoveryV1().EndpointSlices(ns).List(context.TODO(), opts)
},
WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) {
opts.FieldSelector = fieldSelector
return kubeClient.DiscoveryV1().EndpointSlices(ns).Watch(context.TODO(), opts)
},
}
Expand Down
2 changes: 1 addition & 1 deletion internal/store/ingressclass.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func wrapIngressClassFunc(f func(*networkingv1.IngressClass) *metric.Family) fun
}
}

func createIngressClassListWatch(kubeClient clientset.Interface, ns string, fieldSelector string) cache.ListerWatcher {
func createIngressClassListWatch(kubeClient clientset.Interface, _ string, fieldSelector string) cache.ListerWatcher {
return &cache.ListWatch{
ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) {
return kubeClient.NetworkingV1().IngressClasses().List(context.TODO(), opts)
Expand Down
2 changes: 1 addition & 1 deletion internal/store/mutatingwebhookconfiguration.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ var (
}
)

func createMutatingWebhookConfigurationListWatch(kubeClient clientset.Interface, ns string, fieldSelector string) cache.ListerWatcher {
func createMutatingWebhookConfigurationListWatch(kubeClient clientset.Interface, _ string, fieldSelector string) cache.ListerWatcher {
return &cache.ListWatch{
ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) {
return kubeClient.AdmissionregistrationV1().MutatingWebhookConfigurations().List(context.TODO(), opts)
Expand Down
2 changes: 1 addition & 1 deletion internal/store/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ func wrapNodeFunc(f func(*v1.Node) *metric.Family) func(interface{}) *metric.Fam
}
}

func createNodeListWatch(kubeClient clientset.Interface, ns string, fieldSelector string) cache.ListerWatcher {
func createNodeListWatch(kubeClient clientset.Interface, _ string, fieldSelector string) cache.ListerWatcher {
return &cache.ListWatch{
ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) {
return kubeClient.CoreV1().Nodes().List(context.TODO(), opts)
Expand Down
2 changes: 1 addition & 1 deletion internal/store/validatingwebhookconfiguration.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ var (
}
)

func createValidatingWebhookConfigurationListWatch(kubeClient clientset.Interface, ns string, fieldSelector string) cache.ListerWatcher {
func createValidatingWebhookConfigurationListWatch(kubeClient clientset.Interface, _ string, fieldSelector string) cache.ListerWatcher {
return &cache.ListWatch{
ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) {
return kubeClient.AdmissionregistrationV1().ValidatingWebhookConfigurations().List(context.TODO(), opts)
Expand Down
2 changes: 1 addition & 1 deletion pkg/app/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ func (f *fooFactory) Name() string {
}

// CreateClient use fake client set to establish 10 foos.
func (f *fooFactory) CreateClient(cfg *rest.Config) (interface{}, error) {
func (f *fooFactory) CreateClient(_ *rest.Config) (interface{}, error) {
fooClient := samplefake.NewSimpleClientset()
for i := 0; i < 10; i++ {
err := foo(fooClient, i)
Expand Down
20 changes: 10 additions & 10 deletions pkg/builder/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ func TestBuilderWithCustomStore(t *testing.T) {
}
}

func customStore(metricFamilies []generator.FamilyGenerator,
expectedType interface{},
listWatchFunc func(kubeClient clientset.Interface, ns string, fieldSelector string) cache.ListerWatcher,
useAPIServerCache bool,
func customStore(_ []generator.FamilyGenerator,
_ interface{},
_ func(kubeClient clientset.Interface, ns string, fieldSelector string) cache.ListerWatcher,
_ bool,
) []cache.Store {
stores := make([]cache.Store, 0, 2)
stores = append(stores, newFakeStore(fakeMetricLists[0]))
Expand All @@ -84,15 +84,15 @@ type fakeStore struct {
metrics []string
}

func (s *fakeStore) Add(obj interface{}) error {
func (s *fakeStore) Add(_ interface{}) error {
return nil
}

func (s *fakeStore) Update(obj interface{}) error {
func (s *fakeStore) Update(_ interface{}) error {
return nil
}

func (s *fakeStore) Delete(obj interface{}) error {
func (s *fakeStore) Delete(_ interface{}) error {
return nil
}

Expand All @@ -109,15 +109,15 @@ func (s *fakeStore) ListKeys() []string {
return nil
}

func (s *fakeStore) Get(obj interface{}) (item interface{}, exists bool, err error) {
func (s *fakeStore) Get(_ interface{}) (item interface{}, exists bool, err error) {
return nil, false, nil
}

func (s *fakeStore) GetByKey(key string) (item interface{}, exists bool, err error) {
func (s *fakeStore) GetByKey(_ string) (item interface{}, exists bool, err error) {
return nil, false, nil
}

func (s *fakeStore) Replace(list []interface{}, _ string) error {
func (s *fakeStore) Replace(_ []interface{}, _ string) error {
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/metrics_store/metrics_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ func (s *MetricsStore) ListKeys() []string {
}

// Get implements the Get method of the store interface.
func (s *MetricsStore) Get(obj interface{}) (item interface{}, exists bool, err error) {
func (s *MetricsStore) Get(_ interface{}) (item interface{}, exists bool, err error) {
return nil, false, nil
}

// GetByKey implements the GetByKey method of the store interface.
func (s *MetricsStore) GetByKey(key string) (item interface{}, exists bool, err error) {
func (s *MetricsStore) GetByKey(_ string) (item interface{}, exists bool, err error) {
return nil, false, nil
}

Expand Down

0 comments on commit 221b395

Please sign in to comment.