Skip to content

Commit

Permalink
Merge pull request #8191 from Aresforchina/fix-staticcheck-pkg-resour…
Browse files Browse the repository at this point in the history
…ces01

fix staticcheck failures in pkg/resources
  • Loading branch information
k8s-ci-robot committed Dec 25, 2019
2 parents 5cb2d36 + 8ebcea0 commit 22ddc3b
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 36 deletions.
2 changes: 0 additions & 2 deletions hack/.staticcheck_failures
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ cloudmock/aws/mockelbv2
cmd/kops
node-authorizer/pkg/authorizers/aws
node-authorizer/pkg/server
pkg/resources/ali
pkg/resources/digitalocean
pkg/resources/digitalocean/dns
pkg/resources/openstack
pkg/sshcredentials
upup/pkg/fi
upup/pkg/fi/cloudup
upup/pkg/fi/cloudup/awstasks
Expand Down
6 changes: 0 additions & 6 deletions pkg/resources/ali/ali.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ type clusterDiscoveryALI struct {
}

func ListResourcesALI(aliCloud aliup.ALICloud, clusterName string, region string) (map[string]*resources.Resource, error) {
if region == "" {
region = aliCloud.Region()
}

resources := make(map[string]*resources.Resource)

Expand Down Expand Up @@ -412,8 +409,6 @@ func (d *clusterDiscoveryALI) ListRam() ([]*resources.Resource, error) {
"bastions-" + clusterName,
}

roleToDelete := []string{}

response, err := d.aliCloud.RamClient().ListRoles()
if err != nil {
return nil, fmt.Errorf("err listing RamRole:%v", err)
Expand All @@ -424,7 +419,6 @@ func (d *clusterDiscoveryALI) ListRam() ([]*resources.Resource, error) {
for _, role := range response.Roles.Role {
for _, roleName := range names {
if role.RoleName == roleName {
roleToDelete = append(roleToDelete, role.RoleId)
resourceTracker := &resources.Resource{
Name: role.RoleName,
ID: role.RoleId,
Expand Down
5 changes: 1 addition & 4 deletions pkg/sshcredentials/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,5 @@ go_library(
srcs = ["fingerprint.go"],
importpath = "k8s.io/kops/pkg/sshcredentials",
visibility = ["//visibility:public"],
deps = [
"//vendor/golang.org/x/crypto/ssh:go_default_library",
"//vendor/k8s.io/klog:go_default_library",
],
deps = ["//vendor/golang.org/x/crypto/ssh:go_default_library"],
)
24 changes: 0 additions & 24 deletions pkg/sshcredentials/fingerprint.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"fmt"

"golang.org/x/crypto/ssh"
"k8s.io/klog"
)

func Fingerprint(pubkey string) (string, error) {
Expand Down Expand Up @@ -53,26 +52,3 @@ func formatFingerprint(data []byte) string {
}
return buf.String()
}

func insertFingerprintColons(id string) string {
remaining := id

var buf bytes.Buffer
for {
if remaining == "" {
break
}
if buf.Len() != 0 {
buf.WriteString(":")
}
if len(remaining) < 2 {
klog.Warningf("unexpected format for SSH public key id: %q", id)
buf.WriteString(remaining)
break
} else {
buf.WriteString(remaining[0:2])
remaining = remaining[2:]
}
}
return buf.String()
}

0 comments on commit 22ddc3b

Please sign in to comment.