Style tweaks and vendor.json cleanup

This commit is contained in:
Kyle Havlovitz 2017-01-12 16:49:44 -05:00
parent 5ddea8a5df
commit fb68a6bab0
No known key found for this signature in database
GPG Key ID: 8A5E6B173056AD6C
2 changed files with 5 additions and 25 deletions

View File

@ -564,7 +564,7 @@ func (c *Config) discoverGCEHosts(logger *log.Logger) ([]string, error) {
logger.Printf("[INFO] agent: Discovering GCE hosts with tag %s in zones: %s", config.TagValue, strings.Join(zones, ", "))
servers := []string{}
var servers []string
for _, zone := range zones {
addresses, err := gceInstancesAddressesForZone(logger, ctx, computeService, config.ProjectName, zone, config.TagValue)
if err != nil {
@ -611,7 +611,7 @@ func gceProjectIDFromMetadata(logger *log.Logger) (string, error) {
// gceDiscoverZones discovers a list of zones from a supplied zone pattern, or
// all of the zones available to a project.
func gceDiscoverZones(logger *log.Logger, ctx context.Context, computeService *compute.Service, project, pattern string) ([]string, error) {
zones := []string{}
var zones []string
if pattern != "" {
logger.Printf("[INFO] agent: Discovering zones for project %s matching pattern: %s", project, pattern)
@ -641,7 +641,7 @@ func gceDiscoverZones(logger *log.Logger, ctx context.Context, computeService *c
// and zone, matching the supplied tag. Only the private IP addresses are
// returned, but ID is also logged.
func gceInstancesAddressesForZone(logger *log.Logger, ctx context.Context, computeService *compute.Service, project, zone, tag string) ([]string, error) {
addresses := []string{}
var addresses []string
call := computeService.Instances.List(project, zone)
if err := call.Pages(ctx, func(page *compute.InstanceList) error {
for _, v := range page.Items {
@ -842,13 +842,13 @@ func (c *Command) retryJoin(config *Config, errCh chan<- struct{}) {
if err != nil {
logger.Printf("[ERROR] agent: Unable to query EC2 instances: %s", err)
}
logger.Printf("[INFO] agent: Discovered %d servers from EC2...", len(servers))
logger.Printf("[INFO] agent: Discovered %d servers from EC2", len(servers))
case config.RetryJoinGCE.TagValue != "":
servers, err = config.discoverGCEHosts(logger)
if err != nil {
logger.Printf("[ERROR] agent: Unable to query GCE insances: %s", err)
}
logger.Printf("[INFO] agent: Discovered %d servers from GCE.", len(servers))
logger.Printf("[INFO] agent: Discovered %d servers from GCE", len(servers))
}
servers = append(servers, config.RetryJoin...)

20
vendor/vendor.json vendored
View File

@ -2,18 +2,6 @@
"comment": "",
"ignore": "test",
"package": [
{
"path": "appengine",
"revision": ""
},
{
"path": "appengine_internal",
"revision": ""
},
{
"path": "appengine_internal/base",
"revision": ""
},
{
"checksumSHA1": "ZLRh6zW4/DnVsGpgtt+ZiIaEFKc=",
"path": "cloud.google.com/go/compute/metadata",
@ -26,10 +14,6 @@
"revision": "bfdc39bde7a3c8dd361ea7fcdb69e7a41a475bb9",
"revisionTime": "2016-12-01T15:27:07Z"
},
{
"path": "git",
"revision": ""
},
{
"checksumSHA1": "JhyS/zIicgtrSasHSZ6WtXGWJVk=",
"path": "github.com/DataDog/datadog-go/statsd",
@ -911,10 +895,6 @@
"path": "google.golang.org/grpc/transport",
"revision": "708a7f9f3283aa2d4f6132d287d78683babe55c8",
"revisionTime": "2016-12-02T18:43:27Z"
},
{
"path": "log",
"revision": ""
}
],
"rootPath": "github.com/hashicorp/consul"