Ran gofmt -s

This commit is contained in:
Kenneth Shelton 2015-09-23 08:40:51 -07:00
parent 967fac0adc
commit aef8ba00e0

View File

@ -460,11 +460,11 @@ func (gce *GCECloud) EnsureTCPLoadBalancer(name, region string, loadBalancerIP n
func (gce *GCECloud) computeHostTags(hosts []string) ([]string, error) { func (gce *GCECloud) computeHostTags(hosts []string) ([]string, error) {
listCall := gce.service.Instances.List(gce.projectID, gce.zone) listCall := gce.service.Instances.List(gce.projectID, gce.zone)
// Add the filter for hosts // Add the filter for hosts
listCall = listCall.Filter("name eq (" + strings.Join(hosts, "|") + ")") listCall = listCall.Filter("name eq (" + strings.Join(hosts, "|") + ")")
// Add the fields we want // Add the fields we want
listCall = listCall.Fields("items(name,tags)") listCall = listCall.Fields("items(name,tags)")
res, err := listCall.Do() res, err := listCall.Do()
if err != nil { if err != nil {
@ -472,23 +472,23 @@ func (gce *GCECloud) computeHostTags(hosts []string) ([]string, error) {
} }
tags := sets.NewString() tags := sets.NewString()
for _, instance := range res.Items { for _, instance := range res.Items {
longest_tag := "" longest_tag := ""
for _, tag := range instance.Tags.Items { for _, tag := range instance.Tags.Items {
if strings.HasPrefix(instance.Name, tag) && len(tag) > len(longest_tag) { if strings.HasPrefix(instance.Name, tag) && len(tag) > len(longest_tag) {
longest_tag = tag longest_tag = tag
} }
} }
if len(longest_tag) > 0 { if len(longest_tag) > 0 {
tags.Insert(longest_tag) tags.Insert(longest_tag)
} else if len(tags) > 0 { } else if len(tags) > 0 {
return nil, fmt.Errorf("Some, but not all, instances have prefix tags (%s is missing)", instance.Name) return nil, fmt.Errorf("Some, but not all, instances have prefix tags (%s is missing)", instance.Name)
} }
} }
if len(tags) == 0 { if len(tags) == 0 {
glog.V(2).Info("No instances had tags, creating rule without target tags") glog.V(2).Info("No instances had tags, creating rule without target tags")
} }
return tags.List(), nil return tags.List(), nil
} }