From 637a10be12f063574122afe8ea947b9104011cdd Mon Sep 17 00:00:00 2001 From: Justin Santa Barbara Date: Sat, 20 Aug 2016 01:09:19 -0400 Subject: [PATCH] govet fixes --- cmd/kops/delete_secret.go | 2 +- upup/pkg/fi/cloudup/awstasks/instance.go | 2 +- upup/pkg/fi/cloudup/awsup/aws_cloud.go | 2 +- upup/pkg/fi/hashing/hash.go | 2 +- upup/pkg/fi/vfs/context.go | 2 +- upup/pkg/kutil/delete_cluster.go | 2 +- upup/pkg/kutil/import_cluster.go | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cmd/kops/delete_secret.go b/cmd/kops/delete_secret.go index 047b389bdb..6a87912923 100644 --- a/cmd/kops/delete_secret.go +++ b/cmd/kops/delete_secret.go @@ -57,7 +57,7 @@ func (c *DeleteSecretCmd) Run(args []string) error { } if len(secrets) == 0 { - return fmt.Errorf("secret %q not found") + return fmt.Errorf("secret not found") } if len(secrets) != 1 { diff --git a/upup/pkg/fi/cloudup/awstasks/instance.go b/upup/pkg/fi/cloudup/awstasks/instance.go index 80d53e2f35..77586f62c6 100644 --- a/upup/pkg/fi/cloudup/awstasks/instance.go +++ b/upup/pkg/fi/cloudup/awstasks/instance.go @@ -93,7 +93,7 @@ func (e *Instance) Find(c *fi.Context) (*Instance, error) { request.Attribute = aws.String("userData") response, err := cloud.EC2.DescribeInstanceAttribute(request) if err != nil { - return nil, fmt.Errorf("error querying EC2 for user metadata for instance %q: %v", *i.InstanceId) + return nil, fmt.Errorf("error querying EC2 for user metadata for instance %q: %v", *i.InstanceId, err) } if response.UserData != nil { b, err := base64.StdEncoding.DecodeString(aws.StringValue(response.UserData.Value)) diff --git a/upup/pkg/fi/cloudup/awsup/aws_cloud.go b/upup/pkg/fi/cloudup/awsup/aws_cloud.go index a8db9f7ee7..2a55d780a0 100644 --- a/upup/pkg/fi/cloudup/awsup/aws_cloud.go +++ b/upup/pkg/fi/cloudup/awsup/aws_cloud.go @@ -520,5 +520,5 @@ func (c *AWSCloud) FindDNSHostedZone(clusterDNSName string) (string, error) { return id, nil } - return "", fmt.Errorf("Found multiple hosted zones matching cluster %q; please specify the ID of the zone to use") + return "", fmt.Errorf("Found multiple hosted zones matching cluster %q; please specify the ID of the zone to use", clusterDNSName) } diff --git a/upup/pkg/fi/hashing/hash.go b/upup/pkg/fi/hashing/hash.go index 085d92cb42..e5f0b0c5e3 100644 --- a/upup/pkg/fi/hashing/hash.go +++ b/upup/pkg/fi/hashing/hash.go @@ -65,7 +65,7 @@ func (ha HashAlgorithm) FromString(s string) (*Hash, error) { } if len(s) != l { - return nil, fmt.Errorf("invalid %q hash - unexpected length %s", ha, len(s)) + return nil, fmt.Errorf("invalid %q hash - unexpected length %d", ha, len(s)) } hashValue, err := hex.DecodeString(s) diff --git a/upup/pkg/fi/vfs/context.go b/upup/pkg/fi/vfs/context.go index 54fb73b5dd..5e451114f3 100644 --- a/upup/pkg/fi/vfs/context.go +++ b/upup/pkg/fi/vfs/context.go @@ -29,7 +29,7 @@ func (c *VFSContext) ReadFile(location string) ([]byte, error) { // Handle our special case schemas u, err := url.Parse(location) if err != nil { - return nil, fmt.Errorf("error parsing location %q - not a valid URI") + return nil, fmt.Errorf("error parsing location %q - not a valid URI", location) } switch u.Scheme { diff --git a/upup/pkg/kutil/delete_cluster.go b/upup/pkg/kutil/delete_cluster.go index 3ee3193909..5474611b7b 100644 --- a/upup/pkg/kutil/delete_cluster.go +++ b/upup/pkg/kutil/delete_cluster.go @@ -1517,7 +1517,7 @@ func DeleteIAMRole(cloud fi.Cloud, r *ResourceTracker) error { } _, err := c.IAM.DeleteRolePolicy(request) if err != nil { - return fmt.Errorf("error deleting IAM role policy %q %q", roleName, policyName, err) + return fmt.Errorf("error deleting IAM role policy %q %q: %v", roleName, policyName, err) } } diff --git a/upup/pkg/kutil/import_cluster.go b/upup/pkg/kutil/import_cluster.go index 1d76aaa21e..9b00aa5d0c 100644 --- a/upup/pkg/kutil/import_cluster.go +++ b/upup/pkg/kutil/import_cluster.go @@ -623,7 +623,7 @@ func GetInstanceUserData(cloud *awsup.AWSCloud, instanceID string) ([]byte, erro request.Attribute = aws.String("userData") response, err := cloud.EC2.DescribeInstanceAttribute(request) if err != nil { - return nil, fmt.Errorf("error querying EC2 for user metadata for instance %q: %v", instanceID) + return nil, fmt.Errorf("error querying EC2 for user metadata for instance %q: %v", instanceID, err) } if response.UserData != nil { b, err := base64.StdEncoding.DecodeString(aws.StringValue(response.UserData.Value))