1
0
Fork 0

Fix some typos, fmt and imports :)

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
Vincent Demeester 2015-09-24 17:16:13 +02:00
parent cae02b02ac
commit c038dfbd54
11 changed files with 96 additions and 88 deletions

View file

@ -2,13 +2,14 @@ package main
import (
"bytes"
"strconv"
"strings"
"text/template"
"github.com/BurntSushi/toml"
"github.com/BurntSushi/ty/fun"
log "github.com/Sirupsen/logrus"
"github.com/gambol99/go-marathon"
"strconv"
"strings"
"text/template"
)
type MarathonProvider struct {
@ -62,32 +63,32 @@ func (provider *MarathonProvider) Provide(configurationChan chan<- *Configuratio
config := marathon.NewDefaultConfig()
config.URL = provider.Endpoint
config.EventsInterface = provider.NetworkInterface
if client, err := marathon.NewClient(config); err != nil {
client, err := marathon.NewClient(config)
if err != nil {
log.Errorf("Failed to create a client for marathon, error: %s", err)
return
} else {
provider.marathonClient = client
update := make(marathon.EventsChannel, 5)
if provider.Watch {
if err := client.AddEventsListener(update, marathon.EVENTS_APPLICATIONS); err != nil {
log.Errorf("Failed to register for subscriptions, %s", err)
} else {
go func() {
for {
event := <-update
log.Debug("Marathon event receveived", event)
configuration := provider.loadMarathonConfig()
if configuration != nil {
configurationChan <- configuration
}
}
}()
}
}
configuration := provider.loadMarathonConfig()
configurationChan <- configuration
}
provider.marathonClient = client
update := make(marathon.EventsChannel, 5)
if provider.Watch {
if err := client.AddEventsListener(update, marathon.EVENTS_APPLICATIONS); err != nil {
log.Errorf("Failed to register for subscriptions, %s", err)
} else {
go func() {
for {
event := <-update
log.Debug("Marathon event receveived", event)
configuration := provider.loadMarathonConfig()
if configuration != nil {
configurationChan <- configuration
}
}
}()
}
}
configuration := provider.loadMarathonConfig()
configurationChan <- configuration
}
func (provider *MarathonProvider) loadMarathonConfig() *Configuration {