Skip to content

Commit a8001b8

Browse files
authored
Remove unused const, variables and function reported by Golangci-lint (#17582)
* Remove unused const, variables and function reported by Golangci-lint Signed-off-by: Arnaud Meukam <[email protected]> * make gomod executed Signed-off-by: Arnaud Meukam <[email protected]> --------- Signed-off-by: Arnaud Meukam <[email protected]>
1 parent d8a9697 commit a8001b8

File tree

14 files changed

+6
-413
lines changed

14 files changed

+6
-413
lines changed

channels/pkg/cmd/apply_channel.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import (
2828
"github.com/spf13/cobra"
2929
"go.uber.org/multierr"
3030
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
31-
"k8s.io/cli-runtime/pkg/genericclioptions"
3231
"k8s.io/client-go/dynamic"
3332
"k8s.io/client-go/kubernetes"
3433
"k8s.io/client-go/restmapper"
@@ -40,8 +39,6 @@ import (
4039

4140
type ApplyChannelOptions struct {
4241
Yes bool
43-
44-
configFlags genericclioptions.ConfigFlags
4542
}
4643

4744
func NewCmdApplyChannel(f *ChannelsFactory, out io.Writer) *cobra.Command {

cloudmock/openstack/mockcompute/api.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ import (
2020
"net/http/httptest"
2121
"sync"
2222

23-
"github.com/gophercloud/gophercloud/v2/openstack/compute/v2/instanceactions"
24-
2523
"github.com/gophercloud/gophercloud/v2"
2624

2725
"github.com/gophercloud/gophercloud/v2/openstack/compute/v2/flavors"
@@ -37,13 +35,12 @@ type MockClient struct {
3735
openstack.MockOpenstackServer
3836
mutex sync.Mutex
3937

40-
serverGroups map[string]servergroups.ServerGroup
41-
servers map[string]servers.Server
42-
keyPairs map[string]keypairs.KeyPair
43-
images map[string]images.Image
44-
flavors map[string]flavors.Flavor
45-
instanceActions map[string]instanceactions.InstanceAction
46-
networkClient *gophercloud.ServiceClient
38+
serverGroups map[string]servergroups.ServerGroup
39+
servers map[string]servers.Server
40+
keyPairs map[string]keypairs.KeyPair
41+
images map[string]images.Image
42+
flavors map[string]flavors.Flavor
43+
networkClient *gophercloud.ServiceClient
4744
}
4845

4946
// CreateClient will create a new mock networking client

pkg/assets/mirrors.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@ import (
2222
"k8s.io/kops"
2323
)
2424

25-
const (
26-
// defaultKopsMirrorBase will be detected and automatically set to pull from the defaultKopsMirrors
27-
kopsDefaultBase = "https://artifacts.k8s.io/binaries/kops/%s/"
28-
githubKopsMirrorBase = "https://github.com/kubernetes/kops/releases/download/v%s/"
29-
)
30-
3125
type mirrorConfig struct {
3226
Base string
3327
Mirrors []string

protokube/pkg/protokube/aws_volume.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"context"
2121
"fmt"
2222
"io"
23-
"sync"
2423

2524
"github.com/aws/aws-sdk-go-v2/aws"
2625
awsconfig "github.com/aws/aws-sdk-go-v2/config"
@@ -35,8 +34,6 @@ import (
3534

3635
// AWSCloudProvider defines the AWS cloud provider implementation
3736
type AWSCloudProvider struct {
38-
mutex sync.Mutex
39-
4037
clusterTag string
4138
deviceMap map[string]string
4239
ec2 ec2.DescribeInstancesAPIClient

protokube/pkg/protokube/do_volume.go

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import (
2929
"github.com/digitalocean/godo"
3030
"golang.org/x/oauth2"
3131

32-
"k8s.io/kops/protokube/pkg/etcd"
3332
"k8s.io/kops/protokube/pkg/gossip"
3433
gossipdo "k8s.io/kops/protokube/pkg/gossip/do"
3534
)
@@ -154,31 +153,6 @@ func NewDOCloud() (*godo.Client, error) {
154153
return client, nil
155154
}
156155

157-
// getEtcdClusterSpec returns etcd.EtcdClusterSpec which holds
158-
// necessary information required for starting an etcd server.
159-
// DigitalOcean support on kops only supports single master setup for now
160-
// but in the future when it supports multiple masters this method be
161-
// updated to handle that case.
162-
// TODO: use tags once it's supported for volumes
163-
func (d *DOCloudProvider) getEtcdClusterSpec(vol godo.Volume) (*etcd.EtcdClusterSpec, error) {
164-
nodeName := d.dropletName
165-
166-
var clusterKey string
167-
if strings.Contains(vol.Name, "etcd-main") {
168-
clusterKey = "main"
169-
} else if strings.Contains(vol.Name, "etcd-events") {
170-
clusterKey = "events"
171-
} else {
172-
return nil, fmt.Errorf("could not determine etcd cluster type for volume: %s", vol.Name)
173-
}
174-
175-
return &etcd.EtcdClusterSpec{
176-
ClusterKey: clusterKey,
177-
NodeName: nodeName,
178-
NodeNames: []string{nodeName},
179-
}, nil
180-
}
181-
182156
func (d *DOCloudProvider) GossipSeeds() (gossip.SeedProvider, error) {
183157
for _, dropletTag := range d.dropletTags {
184158
if strings.Contains(dropletTag, strings.ReplaceAll(d.ClusterID, ".", "-")) {

upup/pkg/fi/cloudup/awstasks/autoscalinggroup.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -869,24 +869,6 @@ func (e *AutoscalingGroup) getLBsToDetach(currentLBs []*ClassicLoadBalancer) []s
869869
return lbsToDetach
870870
}
871871

872-
// getTGsToDetach loops through the currently set LBs and builds a list of
873-
// target groups to be detached from the Autoscaling Group
874-
func (e *AutoscalingGroup) getTGsToDetach(currentTGs []*TargetGroup) []*string {
875-
tgsToDetach := []*string{}
876-
desiredTGs := map[string]bool{}
877-
878-
for _, v := range e.TargetGroups {
879-
desiredTGs[*v.ARN] = true
880-
}
881-
882-
for _, v := range currentTGs {
883-
if _, ok := desiredTGs[*v.ARN]; !ok {
884-
tgsToDetach = append(tgsToDetach, v.ARN)
885-
}
886-
}
887-
return tgsToDetach
888-
}
889-
890872
// sliceChunks returns a chunked slice
891873
func sliceChunks(slice []string, chunkSize int) [][]string {
892874
var chunks [][]string

upup/pkg/fi/cloudup/awstasks/network_load_balancer.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -765,12 +765,6 @@ type deleteNLB struct {
765765
obj *awsup.LoadBalancerInfo
766766
}
767767

768-
func buildDeleteNLB(obj *awsup.LoadBalancerInfo) *deleteNLB {
769-
d := &deleteNLB{}
770-
d.obj = obj
771-
return d
772-
}
773-
774768
var _ fi.CloudupDeletion = &deleteNLB{}
775769

776770
func (d *deleteNLB) Delete(t fi.CloudupTarget) error {

upup/pkg/fi/cloudup/awsup/aws_authenticator_test.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -371,12 +371,3 @@ func (s *mockHTTPClient) Do(req *http.Request) (*http.Response, error) {
371371
s.t.Fatalf("unexpected request %+v", req)
372372
return nil, fmt.Errorf("unexpected request")
373373
}
374-
375-
type mockHTTPTransport struct {
376-
t *testing.T
377-
}
378-
379-
func (s *mockHTTPTransport) RoundTrip(req *http.Request) (*http.Response, error) {
380-
s.t.Fatalf("unexpected request %+v", req)
381-
return nil, fmt.Errorf("unexpected request")
382-
}

upup/pkg/fi/nodeup/command.go

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -526,26 +526,6 @@ func evaluateBindAddress(bindAddress string) (string, error) {
526526
return bindAddress, nil
527527
}
528528

529-
// kernelHasFilesystem checks if /proc/filesystems contains the specified filesystem
530-
func kernelHasFilesystem(fs string) (bool, error) {
531-
contents, err := os.ReadFile("/proc/filesystems")
532-
if err != nil {
533-
return false, fmt.Errorf("error reading /proc/filesystems: %v", err)
534-
}
535-
536-
for _, line := range strings.Split(string(contents), "\n") {
537-
tokens := strings.Fields(line)
538-
for _, token := range tokens {
539-
// Technically we should skip "nodev", but it doesn't matter
540-
if token == fs {
541-
return true, nil
542-
}
543-
}
544-
}
545-
546-
return false, nil
547-
}
548-
549529
// modprobe will exec `modprobe <module>`
550530
func modprobe(module string) error {
551531
klog.Infof("Doing modprobe for module %v", module)

vendor/github.com/gophercloud/gophercloud/v2/openstack/compute/v2/instanceactions/doc.go

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)