Fix go vet complaints
This commit is contained in:
parent
2caf33f97f
commit
56cf1e6faa
|
@ -107,11 +107,11 @@ func testAccCheckAWSAutoScalingGroupAttributes(group *autoscaling.AutoScalingGro
|
||||||
}
|
}
|
||||||
|
|
||||||
if group.MaxSize != 5 {
|
if group.MaxSize != 5 {
|
||||||
return fmt.Errorf("Bad max_size: %s", group.MaxSize)
|
return fmt.Errorf("Bad max_size: %d", group.MaxSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
if group.MinSize != 2 {
|
if group.MinSize != 2 {
|
||||||
return fmt.Errorf("Bad max_size: %s", group.MinSize)
|
return fmt.Errorf("Bad max_size: %d", group.MinSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
if group.HealthCheckType != "ELB" {
|
if group.HealthCheckType != "ELB" {
|
||||||
|
@ -119,15 +119,15 @@ func testAccCheckAWSAutoScalingGroupAttributes(group *autoscaling.AutoScalingGro
|
||||||
}
|
}
|
||||||
|
|
||||||
if group.HealthCheckGracePeriod != 300 {
|
if group.HealthCheckGracePeriod != 300 {
|
||||||
return fmt.Errorf("Bad health_check_grace_period: %s", group.HealthCheckGracePeriod)
|
return fmt.Errorf("Bad health_check_grace_period: %d", group.HealthCheckGracePeriod)
|
||||||
}
|
}
|
||||||
|
|
||||||
if group.DesiredCapacity != 4 {
|
if group.DesiredCapacity != 4 {
|
||||||
return fmt.Errorf("Bad desired_capacity: %s", group.DesiredCapacity)
|
return fmt.Errorf("Bad desired_capacity: %d", group.DesiredCapacity)
|
||||||
}
|
}
|
||||||
|
|
||||||
if group.LaunchConfigurationName != "" {
|
if group.LaunchConfigurationName != "" {
|
||||||
return fmt.Errorf("Bad desired_capacity: %s", group.DesiredCapacity)
|
return fmt.Errorf("Bad desired_capacity: %d", group.DesiredCapacity)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -139,10 +139,7 @@ func resource_aws_db_instance_update(
|
||||||
s *terraform.ResourceState,
|
s *terraform.ResourceState,
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.ResourceDiff,
|
||||||
meta interface{}) (*terraform.ResourceState, error) {
|
meta interface{}) (*terraform.ResourceState, error) {
|
||||||
|
|
||||||
panic("Cannot update DB")
|
panic("Cannot update DB")
|
||||||
|
|
||||||
return nil, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func resource_aws_db_instance_destroy(
|
func resource_aws_db_instance_destroy(
|
||||||
|
|
|
@ -88,10 +88,7 @@ func resource_aws_db_security_group_update(
|
||||||
s *terraform.ResourceState,
|
s *terraform.ResourceState,
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.ResourceDiff,
|
||||||
meta interface{}) (*terraform.ResourceState, error) {
|
meta interface{}) (*terraform.ResourceState, error) {
|
||||||
|
panic("Cannot update DB security group")
|
||||||
panic("Cannot update DB")
|
|
||||||
|
|
||||||
return nil, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func resource_aws_db_security_group_destroy(
|
func resource_aws_db_security_group_destroy(
|
||||||
|
|
|
@ -135,13 +135,11 @@ func resourceAwsEipDelete(d *schema.ResourceData, meta interface{}) error {
|
||||||
log.Printf("[DEBUG] EIP release (destroy) address allocation: %v", d.Id())
|
log.Printf("[DEBUG] EIP release (destroy) address allocation: %v", d.Id())
|
||||||
_, err = ec2conn.ReleaseAddress(d.Id())
|
_, err = ec2conn.ReleaseAddress(d.Id())
|
||||||
return err
|
return err
|
||||||
} else {
|
|
||||||
log.Printf("[DEBUG] EIP release (destroy) address: %v", d.Id())
|
|
||||||
_, err = ec2conn.ReleasePublicAddress(d.Id())
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
log.Printf("[DEBUG] EIP release (destroy) address: %v", d.Id())
|
||||||
|
_, err = ec2conn.ReleasePublicAddress(d.Id())
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func resourceAwsEipRead(d *schema.ResourceData, meta interface{}) error {
|
func resourceAwsEipRead(d *schema.ResourceData, meta interface{}) error {
|
||||||
|
|
|
@ -100,7 +100,7 @@ func resource_aws_internet_gateway_destroy(
|
||||||
}
|
}
|
||||||
if _, err := stateConf.WaitForState(); err != nil {
|
if _, err := stateConf.WaitForState(); err != nil {
|
||||||
return fmt.Errorf(
|
return fmt.Errorf(
|
||||||
"Error waiting for internet gateway (%s) to destroy",
|
"Error waiting for internet gateway (%s) to destroy: %s",
|
||||||
s.ID, err)
|
s.ID, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,8 +79,6 @@ func resource_aws_launch_configuration_update(
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.ResourceDiff,
|
||||||
meta interface{}) (*terraform.ResourceState, error) {
|
meta interface{}) (*terraform.ResourceState, error) {
|
||||||
panic("Update for AWS Launch Configuration is not supported")
|
panic("Update for AWS Launch Configuration is not supported")
|
||||||
|
|
||||||
return nil, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func resource_aws_launch_configuration_destroy(
|
func resource_aws_launch_configuration_destroy(
|
||||||
|
|
|
@ -88,7 +88,7 @@ func resourceAwsSecurityGroupIngressHash(v interface{}) int {
|
||||||
m := v.(map[string]interface{})
|
m := v.(map[string]interface{})
|
||||||
buf.WriteString(fmt.Sprintf("%d-", m["from_port"].(int)))
|
buf.WriteString(fmt.Sprintf("%d-", m["from_port"].(int)))
|
||||||
buf.WriteString(fmt.Sprintf("%d-", m["to_port"].(int)))
|
buf.WriteString(fmt.Sprintf("%d-", m["to_port"].(int)))
|
||||||
buf.WriteString(fmt.Sprintf("%d-", m["protocol"].(string)))
|
buf.WriteString(fmt.Sprintf("%s-", m["protocol"].(string)))
|
||||||
|
|
||||||
// We need to make sure to sort the strings below so that we always
|
// We need to make sure to sort the strings below so that we always
|
||||||
// generate the same hash code no matter what is in the set.
|
// generate the same hash code no matter what is in the set.
|
||||||
|
|
|
@ -192,11 +192,9 @@ func testAccCheckAWSSecurityGroupExists(n string, group *ec2.SecurityGroupInfo)
|
||||||
*group = resp.Groups[0]
|
*group = resp.Groups[0]
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
} else {
|
|
||||||
return fmt.Errorf("Security Group not found")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return fmt.Errorf("Security Group not found")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,8 +66,6 @@ func resource_aws_subnet_update(
|
||||||
// This should never be called because we have no update-able
|
// This should never be called because we have no update-able
|
||||||
// attributes
|
// attributes
|
||||||
panic("Update for subnet is not supported")
|
panic("Update for subnet is not supported")
|
||||||
|
|
||||||
return nil, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func resource_aws_subnet_destroy(
|
func resource_aws_subnet_destroy(
|
||||||
|
@ -96,7 +94,7 @@ func resource_aws_subnet_destroy(
|
||||||
}
|
}
|
||||||
if _, err := stateConf.WaitForState(); err != nil {
|
if _, err := stateConf.WaitForState(); err != nil {
|
||||||
return fmt.Errorf(
|
return fmt.Errorf(
|
||||||
"Error waiting for subnet (%s) to destroy",
|
"Error waiting for subnet (%s) to destroy: %s",
|
||||||
s.ID, err)
|
s.ID, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -305,7 +305,7 @@ func loadResourcesHcl(os *hclobj.Object) ([]*Resource, error) {
|
||||||
if err := hcl.DecodeObject(&config, obj); err != nil {
|
if err := hcl.DecodeObject(&config, obj); err != nil {
|
||||||
return nil, fmt.Errorf(
|
return nil, fmt.Errorf(
|
||||||
"Error reading config for %s[%s]: %s",
|
"Error reading config for %s[%s]: %s",
|
||||||
t,
|
t.Key,
|
||||||
k,
|
k,
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
@ -320,7 +320,7 @@ func loadResourcesHcl(os *hclobj.Object) ([]*Resource, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf(
|
return nil, fmt.Errorf(
|
||||||
"Error reading config for %s[%s]: %s",
|
"Error reading config for %s[%s]: %s",
|
||||||
t,
|
t.Key,
|
||||||
k,
|
k,
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
@ -332,7 +332,7 @@ func loadResourcesHcl(os *hclobj.Object) ([]*Resource, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf(
|
return nil, fmt.Errorf(
|
||||||
"Error parsing count for %s[%s]: %s",
|
"Error parsing count for %s[%s]: %s",
|
||||||
t,
|
t.Key,
|
||||||
k,
|
k,
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
@ -345,7 +345,7 @@ func loadResourcesHcl(os *hclobj.Object) ([]*Resource, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf(
|
return nil, fmt.Errorf(
|
||||||
"Error reading depends_on for %s[%s]: %s",
|
"Error reading depends_on for %s[%s]: %s",
|
||||||
t,
|
t.Key,
|
||||||
k,
|
k,
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
@ -358,7 +358,7 @@ func loadResourcesHcl(os *hclobj.Object) ([]*Resource, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf(
|
return nil, fmt.Errorf(
|
||||||
"Error reading connection info for %s[%s]: %s",
|
"Error reading connection info for %s[%s]: %s",
|
||||||
t,
|
t.Key,
|
||||||
k,
|
k,
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
@ -372,7 +372,7 @@ func loadResourcesHcl(os *hclobj.Object) ([]*Resource, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf(
|
return nil, fmt.Errorf(
|
||||||
"Error reading provisioners for %s[%s]: %s",
|
"Error reading provisioners for %s[%s]: %s",
|
||||||
t,
|
t.Key,
|
||||||
k,
|
k,
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ func TestResourceBuilder_attrSetComputedComplex(t *testing.T) {
|
||||||
t.Fatalf("err: %s", err)
|
t.Fatalf("err: %s", err)
|
||||||
}
|
}
|
||||||
if diff != nil {
|
if diff != nil {
|
||||||
t.Fatalf("diff shold be nil: %s", diff)
|
t.Fatalf("diff shold be nil: %#v", diff)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,7 +361,7 @@ func TestResourceBuilder_same(t *testing.T) {
|
||||||
t.Fatalf("err: %s", err)
|
t.Fatalf("err: %s", err)
|
||||||
}
|
}
|
||||||
if diff != nil {
|
if diff != nil {
|
||||||
t.Fatal("should not diff: %s", diff)
|
t.Fatalf("should not diff: %#v", diff)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -165,6 +165,6 @@ func TestProviderMeta(t *testing.T) {
|
||||||
expected := 42
|
expected := 42
|
||||||
p.SetMeta(42)
|
p.SetMeta(42)
|
||||||
if v := p.Meta(); !reflect.DeepEqual(v, expected) {
|
if v := p.Meta(); !reflect.DeepEqual(v, expected) {
|
||||||
t.Fatalf("bad: %#v")
|
t.Fatalf("bad: %#v", v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -244,7 +244,7 @@ func (d *ResourceData) get(
|
||||||
case TypeString:
|
case TypeString:
|
||||||
return d.getPrimitive(k, parts, schema, source)
|
return d.getPrimitive(k, parts, schema, source)
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("%s: unknown type %s", k, schema.Type))
|
panic(fmt.Sprintf("%s: unknown type %#v", k, schema.Type))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -570,7 +570,7 @@ func (d *ResourceData) getPrimitive(
|
||||||
|
|
||||||
resultValue = int(v)
|
resultValue = int(v)
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("Unknown type: %s", schema.Type))
|
panic(fmt.Sprintf("Unknown type: %#v", schema.Type))
|
||||||
}
|
}
|
||||||
|
|
||||||
return getResult{
|
return getResult{
|
||||||
|
@ -600,7 +600,7 @@ func (d *ResourceData) set(
|
||||||
case TypeString:
|
case TypeString:
|
||||||
return d.setPrimitive(k, schema, value)
|
return d.setPrimitive(k, schema, value)
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("%s: unknown type %s", k, schema.Type))
|
panic(fmt.Sprintf("%s: unknown type %#v", k, schema.Type))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -773,7 +773,7 @@ func (d *ResourceData) setPrimitive(
|
||||||
|
|
||||||
set = strconv.FormatInt(int64(n), 10)
|
set = strconv.FormatInt(int64(n), 10)
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("Unknown type: %s", schema.Type)
|
return fmt.Errorf("Unknown type: %#v", schema.Type)
|
||||||
}
|
}
|
||||||
|
|
||||||
d.setMap[k] = set
|
d.setMap[k] = set
|
||||||
|
@ -888,7 +888,7 @@ func (d *ResourceData) statePrimitive(
|
||||||
case TypeInt:
|
case TypeInt:
|
||||||
vs = strconv.FormatInt(int64(v.(int)), 10)
|
vs = strconv.FormatInt(int64(v.(int)), 10)
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("Unknown type: %s", schema.Type))
|
panic(fmt.Sprintf("Unknown type: %#v", schema.Type))
|
||||||
}
|
}
|
||||||
|
|
||||||
return map[string]string{
|
return map[string]string{
|
||||||
|
@ -944,6 +944,6 @@ func (d *ResourceData) stateSingle(
|
||||||
case TypeString:
|
case TypeString:
|
||||||
return d.statePrimitive(prefix, schema)
|
return d.statePrimitive(prefix, schema)
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("%s: unknown type %s", prefix, schema.Type))
|
panic(fmt.Sprintf("%s: unknown type %#v", prefix, schema.Type))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -248,7 +248,7 @@ func (m schemaMap) diff(
|
||||||
case TypeSet:
|
case TypeSet:
|
||||||
err = m.diffSet(k, schema, diff, d)
|
err = m.diffSet(k, schema, diff, d)
|
||||||
default:
|
default:
|
||||||
err = fmt.Errorf("%s: unknown type %s", k, schema.Type)
|
err = fmt.Errorf("%s: unknown type %#v", k, schema.Type)
|
||||||
}
|
}
|
||||||
|
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -82,10 +82,10 @@ func newMockLineServer(t *testing.T) string {
|
||||||
}
|
}
|
||||||
t.Log("Accepted channel")
|
t.Log("Accepted channel")
|
||||||
|
|
||||||
go func() {
|
go func(newChannel ssh.NewChannel) {
|
||||||
defer channel.Close()
|
defer channel.Close()
|
||||||
conn.OpenChannel(newChannel.ChannelType(), nil)
|
conn.OpenChannel(newChannel.ChannelType(), nil)
|
||||||
}()
|
}(newChannel)
|
||||||
}
|
}
|
||||||
conn.Close()
|
conn.Close()
|
||||||
}()
|
}()
|
||||||
|
|
Loading…
Reference in New Issue