Repository: allegro/marathon-consul
Pull request #117 (2016-09-08 13:43:22)

Add linter and fix issues
Added `gometalinter` to as a Travis build step. Fixed couple of issues (mostly naming). We can't introduce `golint` until we add comment to public function/struct/type/variable/constant.

coveralls: 
[![Coverage Status](https://coveralls.io/builds/7798806/badge)](https://coveralls.io/builds/7798806)

Coverage decreased (-0.3%) to 79.145% when pulling **58338572df667344123136d8efe3ecb78cdd0fa6 on add_linter** into **a3a244dfe292889f9a692eff73e78f6d7b48ddcd on develop**.

coveralls: 
[![Coverage Status](https://coveralls.io/builds/7799004/badge)](https://coveralls.io/builds/7799004)

Coverage decreased (-0.3%) to 79.145% when pulling **90a6645941e83492a13ca8474479af6c1469ecc8 on add_linter** into **a3a244dfe292889f9a692eff73e78f6d7b48ddcd on develop**.

coveralls: 
[![Coverage Status](https://coveralls.io/builds/7799050/badge)](https://coveralls.io/builds/7799050)

Coverage decreased (-0.3%) to 79.145% when pulling **90a6645941e83492a13ca8474479af6c1469ecc8 on add_linter** into **a3a244dfe292889f9a692eff73e78f6d7b48ddcd on develop**.

coveralls: 
[![Coverage Status](https://coveralls.io/builds/7812923/badge)](https://coveralls.io/builds/7812923)

Coverage decreased (-0.3%) to 79.145% when pulling **a6472f1f25db3540f0b5b2d3b8cbf04a16ed1e47 on add_linter** into **a3a244dfe292889f9a692eff73e78f6d7b48ddcd on develop**.

dankraw: 👍 

Patch:
diff --git a/.travis.yml b/.travis.yml
index 6d950bb..a6d63b3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -9,8 +9,11 @@ before_install:
   - go get github.com/modocache/gover
   - go get github.com/mattn/goveralls
   - if ! go get github.com/golang/tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi
+  - go get github.com/alecthomas/gometalinter
 script:
   - make deps
+  - gometalinter --install
+  - gometalinter ./... --deadline 120s --vendor -D dupl -D gotype -D errcheck -D gas -D golint -E gofmt
   - go test -coverprofile=apps.coverprofile ./apps
   - go test -coverprofile=config.coverprofile ./config
   - go test -coverprofile=consul.coverprofile ./consul
diff --git a/apps/app.go b/apps/app.go
index a352789..5faa498 100644
--- a/apps/app.go
+++ b/apps/app.go
@@ -8,7 +8,7 @@ import (
 )
 
 // Only Marathon apps with this label will be registered in Consul
-const MARATHON_CONSUL_LABEL = "consul"
+const MarathonConsulLabel = "consul"
 
 type HealthCheck struct {
 	Path                   string `json:"path"`
@@ -32,14 +32,14 @@ type AppWrapper struct {
 	App App `json:"app"`
 }
 
-type AppsResponse struct {
+type Apps struct {
 	Apps []*App `json:"apps"`
 }
 
 type App struct {
 	Labels          map[string]string `json:"labels"`
 	HealthChecks    []HealthCheck     `json:"healthChecks"`
-	ID              AppId             `json:"id"`
+	ID              AppID             `json:"id"`
 	Tasks           []Task            `json:"tasks"`
 	PortDefinitions []PortDefinition  `json:"portDefinitions"`
 }
@@ -47,14 +47,14 @@ type App struct {
 // Marathon Application Id (aka PathId)
 // Usually in the form of /rootGroup/subGroup/subSubGroup/name
 // allowed characters: lowercase letters, digits, hyphens, slash
-type AppId string
+type AppID string
 
-func (id AppId) String() string {
+func (id AppID) String() string {
 	return string(id)
 }
 
 func (app *App) IsConsulApp() bool {
-	_, ok := app.Labels[MARATHON_CONSUL_LABEL]
+	_, ok := app.Labels[MarathonConsulLabel]
 	return ok
 }
 
@@ -89,7 +89,7 @@ func (app *App) ConsulNames(separator string) []string {
 }
 
 func (app *App) labelsToRawName(labels map[string]string) string {
-	if value, ok := labels[MARATHON_CONSUL_LABEL]; ok && !isSpecialConsulNameValue(value) {
+	if value, ok := labels[MarathonConsulLabel]; ok && !isSpecialConsulNameValue(value) {
 		return value
 	}
 	return app.ID.String()
@@ -100,7 +100,7 @@ func isSpecialConsulNameValue(name string) bool {
 }
 
 func ParseApps(jsonBlob []byte) ([]*App, error) {
-	apps := &AppsResponse{}
+	apps := &Apps{}
 	err := json.Unmarshal(jsonBlob, apps)
 
 	return apps.Apps, err
@@ -138,7 +138,7 @@ func (app *App) RegistrationIntents(task *Task, nameSeparator string) []*Registr
 	definitions := app.findConsulPortDefinitions()
 	if len(definitions) == 0 {
 		return []*RegistrationIntent{
-			&RegistrationIntent{
+			{
 				Name: app.labelsToName(app.Labels, nameSeparator),
 				Port: task.Ports[0],
 				Tags: commonTags,
@@ -176,7 +176,7 @@ func (app *App) labelsToName(labels map[string]string, nameSeparator string) str
 	serviceName := marathonAppNameToServiceName(appConsulName, nameSeparator)
 	if serviceName == "" {
 		log.WithField("AppId", app.ID.String()).WithField("ConsulServiceName", appConsulName).
-		Warn("Warning! Invalid Consul service name provided for app. Will use default app name instead.")
+			Warn("Warning! Invalid Consul service name provided for app. Will use default app name instead.")
 		return marathonAppNameToServiceName(app.ID.String(), nameSeparator)
 	}
 	return serviceName
@@ -198,7 +198,7 @@ func (i *IndexedPortDefinition) toPort(task *Task) int {
 func (app *App) findConsulPortDefinitions() []IndexedPortDefinition {
 	var definitions []IndexedPortDefinition
 	for i, d := range app.PortDefinitions {
-		if _, ok := d.Labels[MARATHON_CONSUL_LABEL]; ok {
+		if _, ok := d.Labels[MarathonConsulLabel]; ok {
 			definitions = append(definitions, IndexedPortDefinition{
 				Index:  i,
 				Port:   d.Port,
diff --git a/apps/task.go b/apps/task.go
index 164b665..6817575 100644
--- a/apps/task.go
+++ b/apps/task.go
@@ -6,25 +6,25 @@ import (
 )
 
 type Task struct {
-	ID                 TaskId              `json:"id"`
+	ID                 TaskID              `json:"id"`
 	TaskStatus         string              `json:"taskStatus"`
-	AppID              AppId               `json:"appId"`
+	AppID              AppID               `json:"appId"`
 	Host               string              `json:"host"`
 	Ports              []int               `json:"ports"`
 	HealthCheckResults []HealthCheckResult `json:"healthCheckResults"`
 }
 
-// Marathon Task Id
+// Marathon Task ID
 // Usually in the form of AppId.uuid with '/' replaced with '_'
-type TaskId string
+type TaskID string
 
-func (id TaskId) String() string {
+func (id TaskID) String() string {
 	return string(id)
 }
 
-func (id TaskId) AppId() AppId {
+func (id TaskID) AppID() AppID {
 	index := strings.LastIndex(id.String(), ".")
-	return AppId("/" + strings.Replace(id.String()[0:index], "_", "/", -1))
+	return AppID("/" + strings.Replace(id.String()[0:index], "_", "/", -1))
 }
 
 type HealthCheckResult struct {
diff --git a/config/config.go b/config/config.go
index c4dbde3..56f3beb 100644
--- a/config/config.go
+++ b/config/config.go
@@ -17,7 +17,7 @@ import (
 )
 
 type Config struct {
-	Consul   consul.ConsulConfig
+	Consul   consul.Config
 	Web      web.Config
 	Sync     sync.Config
 	Marathon marathon.Config
diff --git a/consul/agent.go b/consul/agent.go
index dbc2ef1..91de414 100644
--- a/consul/agent.go
+++ b/consul/agent.go
@@ -9,10 +9,9 @@ import (
 )
 
 type Agent struct {
-	Client        *consulapi.Client
-	IP            string
-	failures      uint32
-	failureMetric string
+	Client   *consulapi.Client
+	IP       string
+	failures uint32
 }
 
 func (a *Agent) IncFailures() uint32 {
diff --git a/consul/agents.go b/consul/agents.go
index ccf7247..002f9ca 100644
--- a/consul/agents.go
+++ b/consul/agents.go
@@ -2,7 +2,7 @@ package consul
 
 import (
 	"crypto/tls"
-	"fmt"
+	"errors"
 	"math/rand"
 	"net/http"
 	"sync"
@@ -21,12 +21,12 @@ type Agents interface {
 
 type ConcurrentAgents struct {
 	agents map[string]*Agent
-	config *ConsulConfig
+	config *Config
 	lock   sync.Mutex
 	client *http.Client
 }
 
-func NewAgents(config *ConsulConfig) *ConcurrentAgents {
+func NewAgents(config *Config) *ConcurrentAgents {
 	client := &http.Client{
 		Transport: &http.Transport{
 			Proxy: http.ProxyFromEnvironment,
@@ -48,13 +48,13 @@ func (a *ConcurrentAgents) GetAnyAgent() (*Agent, error) {
 	defer a.lock.Unlock()
 
 	if len(a.agents) > 0 {
-		ipAddress := a.getRandomAgentIpAddress()
+		ipAddress := a.getRandomAgentIPAddress()
 		return a.agents[ipAddress], nil
 	}
-	return nil, fmt.Errorf("No Consul client available in agents cache")
+	return nil, errors.New("No Consul client available in agents cache")
 }
 
-func (a *ConcurrentAgents) getRandomAgentIpAddress() string {
+func (a *ConcurrentAgents) getRandomAgentIPAddress() string {
 	ipAddresses := []string{}
 	for ipAddress := range a.agents {
 		ipAddresses = append(ipAddresses, ipAddress)
diff --git a/consul/config.go b/consul/config.go
index 3c6388b..715e410 100644
--- a/consul/config.go
+++ b/consul/config.go
@@ -2,7 +2,7 @@ package consul
 
 import "time"
 
-type ConsulConfig struct {
+type Config struct {
 	Auth                   Auth
 	Port                   string
 	SslEnabled             bool
diff --git a/consul/consul.go b/consul/consul.go
index 4f58df6..bf9f6fa 100644
--- a/consul/consul.go
+++ b/consul/consul.go
@@ -15,12 +15,12 @@ import (
 
 type Consul struct {
 	agents Agents
-	config ConsulConfig
+	config Config
 }
 
 type ServicesProvider func(agent *consulapi.Client) ([]*service.Service, error)
 
-func New(config ConsulConfig) *Consul {
+func New(config Config) *Consul {
 	return &Consul{
 		agents: NewAgents(&config),
 		config: config,
@@ -148,7 +148,7 @@ func (c *Consul) Register(task *apps.Task, app *apps.App) error {
 	if err != nil {
 		return err
 	}
-	if value, ok := app.Labels[apps.MARATHON_CONSUL_LABEL]; ok && value == "true" {
+	if value, ok := app.Labels[apps.MarathonConsulLabel]; ok && value == "true" {
 		log.WithField("Id", app.ID).Warn("Warning! Application configuration is deprecated (labeled as `consul:true`). Support for special `true` value will be removed in the future!")
 	}
 	metrics.Time("consul.register", func() { err = c.registerMultipleServices(services) })
@@ -193,17 +193,17 @@ func (c *Consul) register(service *consulapi.AgentServiceRegistration) error {
 	return err
 }
 
-func (c *Consul) DeregisterByTask(taskId apps.TaskId) error {
-	services, err := c.findServicesByTaskId(taskId)
+func (c *Consul) DeregisterByTask(taskID apps.TaskID) error {
+	services, err := c.findServicesByTaskID(taskID)
 	if err != nil {
 		return err
 	} else if len(services) == 0 {
-		return fmt.Errorf("Couldn't find any service matching task id %s", taskId)
+		return fmt.Errorf("Couldn't find any service matching task id %s", taskID)
 	}
-	return c.deregisterMultipleServices(services, taskId)
+	return c.deregisterMultipleServices(services, taskID)
 }
 
-func (c *Consul) deregisterMultipleServices(services []*service.Service, taskId apps.TaskId) error {
+func (c *Consul) deregisterMultipleServices(services []*service.Service, taskID apps.TaskID) error {
 	var deregisterErrors []error
 	for _, s := range services {
 		deregisterErr := c.Deregister(s)
@@ -212,10 +212,10 @@ func (c *Consul) deregisterMultipleServices(services []*service.Service, taskId
 		}
 	}
 
-	return utils.MergeErrorsOrNil(deregisterErrors, fmt.Sprintf("deregistering by task %s", taskId))
+	return utils.MergeErrorsOrNil(deregisterErrors, fmt.Sprintf("deregistering by task %s", taskID))
 }
 
-func (c *Consul) findServicesByTaskId(searchedTaskId apps.TaskId) ([]*service.Service, error) {
+func (c *Consul) findServicesByTaskID(searchedTaskID apps.TaskID) ([]*service.Service, error) {
 	return c.getServicesUsingProviderWithRetriesOnAgentFailure(func(agent *consulapi.Client) ([]*service.Service, error) {
 		dcAwareQueries, err := dcAwareQueriesForAllDCs(agent)
 		if err != nil {
@@ -223,7 +223,7 @@ func (c *Consul) findServicesByTaskId(searchedTaskId apps.TaskId) ([]*service.Se
 		}
 
 		var allFound []*service.Service
-		searchedTag := service.MarathonTaskTag(searchedTaskId)
+		searchedTag := service.MarathonTaskTag(searchedTaskID)
 		for _, dcAwareQuery := range dcAwareQueries {
 			consulServices, _, err := agent.Catalog().Services(dcAwareQuery)
 			if err != nil {
@@ -286,7 +286,7 @@ func (c *Consul) marathonTaskToConsulServices(task *apps.Task, app *apps.App) ([
 		tags := append([]string{c.config.Tag}, intent.Tags...)
 		tags = append(tags, service.MarathonTaskTag(task.ID))
 		registrations = append(registrations, &consulapi.AgentServiceRegistration{
-			ID:      c.serviceId(task, intent.Name, intent.Port),
+			ID:      c.serviceID(task, intent.Name, intent.Port),
 			Name:    intent.Name,
 			Port:    intent.Port,
 			Address: serviceAddress,
@@ -297,22 +297,22 @@ func (c *Consul) marathonTaskToConsulServices(task *apps.Task, app *apps.App) ([
 	return registrations, nil
 }
 
-func (c *Consul) serviceId(task *apps.Task, name string, port int) string {
+func (c *Consul) serviceID(task *apps.Task, name string, port int) string {
 	return fmt.Sprintf("%s_%s_%d", task.ID, name, port)
 }
 
 func (c *Consul) marathonToConsulChecks(task *apps.Task, healthChecks []apps.HealthCheck, serviceAddress string) consulapi.AgentServiceChecks {
-	var checks consulapi.AgentServiceChecks = make(consulapi.AgentServiceChecks, 0, len(healthChecks))
+	var checks = make(consulapi.AgentServiceChecks, 0, len(healthChecks))
 
 	for _, check := range healthChecks {
 		switch check.Protocol {
 		case "HTTP", "HTTPS":
-			if parsedUrl, err := url.ParseRequestURI(check.Path); err == nil {
-				parsedUrl.Scheme = strings.ToLower(check.Protocol)
-				parsedUrl.Host = fmt.Sprintf("%s:%d", serviceAddress, task.Ports[check.PortIndex])
+			if parsedURL, err := url.ParseRequestURI(check.Path); err == nil {
+				parsedURL.Scheme = strings.ToLower(check.Protocol)
+				parsedURL.Host = fmt.Sprintf("%s:%d", serviceAddress, task.Ports[check.PortIndex])
 
 				checks = append(checks, &consulapi.AgentServiceCheck{
-					HTTP:     parsedUrl.String(),
+					HTTP:     parsedURL.String(),
 					Interval: fmt.Sprintf("%ds", check.IntervalSeconds),
 					Timeout:  fmt.Sprintf("%ds", check.TimeoutSeconds),
 				})
diff --git a/consul/consul_stub.go b/consul/consul_stub.go
index d914161..86994a6 100644
--- a/consul/consul_stub.go
+++ b/consul/consul_stub.go
@@ -9,60 +9,60 @@ import (
 )
 
 // TODO this should be a service registry stub in the service package, requires abstracting from AgentServiceRegistration
-type ConsulStub struct {
+type Stub struct {
 	services                   map[service.ServiceId]*consulapi.AgentServiceRegistration
 	failGetServicesForNames    map[string]bool
-	failRegisterForIds         map[apps.TaskId]bool
-	failDeregisterByTaskForIds map[apps.TaskId]bool
-	failDeregisterForIds       map[service.ServiceId]bool
+	failRegisterForIDs         map[apps.TaskID]bool
+	failDeregisterByTaskForIDs map[apps.TaskID]bool
+	failDeregisterForIDs       map[service.ServiceId]bool
 	consul                     *Consul
 }
 
-func NewConsulStub() *ConsulStub {
+func NewConsulStub() *Stub {
 	return NewConsulStubWithTag("marathon")
 }
 
-func NewConsulStubWithTag(tag string) *ConsulStub {
-	return &ConsulStub{
+func NewConsulStubWithTag(tag string) *Stub {
+	return &Stub{
 		services:                   make(map[service.ServiceId]*consulapi.AgentServiceRegistration),
 		failGetServicesForNames:    make(map[string]bool),
-		failRegisterForIds:         make(map[apps.TaskId]bool),
-		failDeregisterByTaskForIds: make(map[apps.TaskId]bool),
-		failDeregisterForIds:       make(map[service.ServiceId]bool),
-		consul:                     New(ConsulConfig{Tag: tag, ConsulNameSeparator: "."}),
+		failRegisterForIDs:         make(map[apps.TaskID]bool),
+		failDeregisterByTaskForIDs: make(map[apps.TaskID]bool),
+		failDeregisterForIDs:       make(map[service.ServiceId]bool),
+		consul:                     New(Config{Tag: tag, ConsulNameSeparator: "."}),
 	}
 }
 
-func (c ConsulStub) GetAllServices() ([]*service.Service, error) {
+func (c Stub) GetAllServices() ([]*service.Service, error) {
 	var allServices []*service.Service
 	for _, s := range c.services {
 		allServices = append(allServices, &service.Service{
 			ID:   service.ServiceId(s.ID),
 			Name: s.Name,
-			RegisteringAgentAddress: s.Address,
 			Tags: s.Tags,
+			RegisteringAgentAddress: s.Address,
 		})
 	}
 	return allServices, nil
 }
 
-func (c ConsulStub) FailGetServicesForName(failOnName string) {
+func (c Stub) FailGetServicesForName(failOnName string) {
 	c.failGetServicesForNames[failOnName] = true
 }
 
-func (c ConsulStub) FailRegisterForId(taskId apps.TaskId) {
-	c.failRegisterForIds[taskId] = true
+func (c Stub) FailRegisterForID(taskID apps.TaskID) {
+	c.failRegisterForIDs[taskID] = true
 }
 
-func (c ConsulStub) FailDeregisterByTaskForId(taskId apps.TaskId) {
-	c.failDeregisterByTaskForIds[taskId] = true
+func (c Stub) FailDeregisterByTaskForID(taskID apps.TaskID) {
+	c.failDeregisterByTaskForIDs[taskID] = true
 }
 
-func (c ConsulStub) FailDeregisterForId(serviceId service.ServiceId) {
-	c.failDeregisterForIds[serviceId] = true
+func (c Stub) FailDeregisterForID(serviceID service.ServiceId) {
+	c.failDeregisterForIDs[serviceID] = true
 }
 
-func (c ConsulStub) GetServices(name string) ([]*service.Service, error) {
+func (c Stub) GetServices(name string) ([]*service.Service, error) {
 	if _, ok := c.failGetServicesForNames[name]; ok {
 		return nil, fmt.Errorf("Consul stub programmed to fail when getting services for name %s", name)
 	}
@@ -72,30 +72,29 @@ func (c ConsulStub) GetServices(name string) ([]*service.Service, error) {
 			services = append(services, &service.Service{
 				ID:   service.ServiceId(s.ID),
 				Name: s.Name,
-				RegisteringAgentAddress: s.Address,
 				Tags: s.Tags,
+				RegisteringAgentAddress: s.Address,
 			})
 		}
 	}
 	return services, nil
 }
 
-func (c *ConsulStub) Register(task *apps.Task, app *apps.App) error {
-	if _, ok := c.failRegisterForIds[task.ID]; ok {
+func (c *Stub) Register(task *apps.Task, app *apps.App) error {
+	if _, ok := c.failRegisterForIDs[task.ID]; ok {
 		return fmt.Errorf("Consul stub programmed to fail when registering task of id %s", task.ID.String())
-	} else {
-		serviceRegistrations, err := c.consul.marathonTaskToConsulServices(task, app)
-		if err != nil {
-			return err
-		}
-		for _, r := range serviceRegistrations {
-			c.services[service.ServiceId(r.ID)] = r
-		}
-		return nil
 	}
+	serviceRegistrations, err := c.consul.marathonTaskToConsulServices(task, app)
+	if err != nil {
+		return err
+	}
+	for _, r := range serviceRegistrations {
+		c.services[service.ServiceId(r.ID)] = r
+	}
+	return nil
 }
 
-func (c *ConsulStub) RegisterWithoutMarathonTaskTag(task *apps.Task, app *apps.App) {
+func (c *Stub) RegisterWithoutMarathonTaskTag(task *apps.Task, app *apps.App) {
 	for _, intent := range app.RegistrationIntents(task, c.consul.config.ConsulNameSeparator) {
 		serviceRegistration := consulapi.AgentServiceRegistration{
 			ID:      task.ID.String(),
@@ -109,50 +108,49 @@ func (c *ConsulStub) RegisterWithoutMarathonTaskTag(task *apps.Task, app *apps.A
 	}
 }
 
-func (c *ConsulStub) RegisterOnlyFirstRegistrationIntent(task *apps.Task, app *apps.App) {
+func (c *Stub) RegisterOnlyFirstRegistrationIntent(task *apps.Task, app *apps.App) {
 	serviceRegistrations, _ := c.consul.marathonTaskToConsulServices(task, app)
 	c.services[service.ServiceId(serviceRegistrations[0].ID)] = serviceRegistrations[0]
 }
 
-func (c *ConsulStub) ServiceNames(app *apps.App) []string {
+func (c *Stub) ServiceNames(app *apps.App) []string {
 	return c.consul.ServiceNames(app)
 }
 
-func (c *ConsulStub) DeregisterByTask(taskId apps.TaskId) error {
-	if _, ok := c.failDeregisterByTaskForIds[taskId]; ok {
-		return fmt.Errorf("Consul stub programmed to fail when deregistering task of id %s", taskId.String())
-	} else {
-		for _, x := range c.servicesMatchingTask(c.services, taskId) {
-			delete(c.services, service.ServiceId(x.ID))
-		}
-		return nil
+func (c *Stub) DeregisterByTask(taskID apps.TaskID) error {
+	if _, ok := c.failDeregisterByTaskForIDs[taskID]; ok {
+		return fmt.Errorf("Consul stub programmed to fail when deregistering task of id %s", taskID.String())
+	}
+	for _, x := range c.servicesMatchingTask(taskID) {
+		delete(c.services, service.ServiceId(x.ID))
 	}
+	return nil
 }
 
-func (c *ConsulStub) Deregister(toDeregister *service.Service) error {
-	if _, ok := c.failDeregisterForIds[toDeregister.ID]; ok {
+func (c *Stub) Deregister(toDeregister *service.Service) error {
+	if _, ok := c.failDeregisterForIDs[toDeregister.ID]; ok {
 		return fmt.Errorf("Consul stub programmed to fail when deregistering service of id %s", toDeregister.ID)
 	}
 	delete(c.services, toDeregister.ID)
 	return nil
 }
 
-func (c *ConsulStub) servicesMatchingTask(services map[service.ServiceId]*consulapi.AgentServiceRegistration, taskId apps.TaskId) []*consulapi.AgentServiceRegistration {
+func (c *Stub) servicesMatchingTask(taskID apps.TaskID) []*consulapi.AgentServiceRegistration {
 	matching := []*consulapi.AgentServiceRegistration{}
-	for _, s := range services {
-		if s.ID == taskId.String() || contains(s.Tags, fmt.Sprintf("marathon-task:%s", taskId.String())) {
+	for _, s := range c.services {
+		if s.ID == taskID.String() || contains(s.Tags, fmt.Sprintf("marathon-task:%s", taskID.String())) {
 			matching = append(matching, s)
 		}
 	}
 	return matching
 }
 
-func (c *ConsulStub) RegisteredTaskIds() []apps.TaskId {
+func (c *Stub) RegisteredTaskIDs() []apps.TaskID {
 	services, _ := c.GetAllServices()
-	taskIds := []apps.TaskId{}
+	taskIds := []apps.TaskID{}
 	for _, s := range services {
-		taskId, _ := s.TaskId()
-		taskIds = append(taskIds, taskId)
+		taskID, _ := s.TaskId()
+		taskIds = append(taskIds, taskID)
 	}
 	return taskIds
 }
diff --git a/events/deployment_info.go b/events/deployment_info.go
index c57a649..351a0ee 100644
--- a/events/deployment_info.go
+++ b/events/deployment_info.go
@@ -19,7 +19,7 @@ type Plan struct {
 }
 
 type Deployments struct {
-	Id     string         `json:"id"`
+	ID     string         `json:"id"`
 	Apps   []*apps.App    `json:"apps"`
 	Groups []*Deployments `json:"groups"`
 }
@@ -30,7 +30,7 @@ type CurrentStep struct {
 
 type Action struct {
 	Type  string     `json:"type"`
-	AppId apps.AppId `json:"app"`
+	AppID apps.AppID `json:"app"`
 }
 
 func (d *Deployments) groups() []*Deployments {
@@ -100,8 +100,8 @@ func (d *DeploymentEvent) RenamedConsulApps() []*apps.App {
 	return renamedApps
 }
 
-func (d *DeploymentEvent) appsMap(applications []*apps.App) map[apps.AppId]*apps.App {
-	result := make(map[apps.AppId]*apps.App)
+func (d *DeploymentEvent) appsMap(applications []*apps.App) map[apps.AppID]*apps.App {
+	result := make(map[apps.AppID]*apps.App)
 	for _, app := range applications {
 		result[app.ID] = app
 	}
@@ -109,12 +109,12 @@ func (d *DeploymentEvent) appsMap(applications []*apps.App) map[apps.AppId]*apps
 }
 
 func (d *DeploymentEvent) consulAppsWithActionPerformed(deployments *Deployments, actionType string) []*apps.App {
-	appIds := make(map[apps.AppId]struct{})
+	appIds := make(map[apps.AppID]struct{})
 	var exists struct{}
 
 	for _, action := range d.actions() {
 		if action.Type == actionType {
-			appIds[action.AppId] = exists
+			appIds[action.AppID] = exists
 		}
 	}
 	return d.filterConsulApps(d.findAppsInDeploymentsGroup(appIds, deployments))
@@ -130,23 +130,17 @@ func (d *DeploymentEvent) filterConsulApps(allApps []*apps.App) []*apps.App {
 	return filtered
 }
 
-func (d *DeploymentEvent) findAppsInDeploymentsGroup(appIds map[apps.AppId]struct{}, deployment *Deployments) []*apps.App {
+func (d *DeploymentEvent) findAppsInDeploymentsGroup(appIds map[apps.AppID]struct{}, deployment *Deployments) []*apps.App {
 	foundApps := []*apps.App{}
 	filteredAppIds := deployment.filterCurrentGroupAppIds(appIds)
-
 	foundInCurrentGroup := d.findAppsInCurrentDeploymentGroupApps(filteredAppIds, deployment)
-	for _, app := range foundInCurrentGroup {
-		foundApps = append(foundApps, app)
-	}
-
+	foundApps = append(foundApps, foundInCurrentGroup...)
 	foundInChildGroups := d.findAppsInDeploymentChildGroups(filteredAppIds, deployment)
-	for _, app := range foundInChildGroups {
-		foundApps = append(foundApps, app)
-	}
+	foundApps = append(foundApps, foundInChildGroups...)
 	return foundApps
 }
 
-func (d *DeploymentEvent) findAppsInCurrentDeploymentGroupApps(appIds map[apps.AppId]struct{}, deployment *Deployments) []*apps.App {
+func (d *DeploymentEvent) findAppsInCurrentDeploymentGroupApps(appIds map[apps.AppID]struct{}, deployment *Deployments) []*apps.App {
 	foundApps := []*apps.App{}
 	searchForCount := len(appIds)
 
@@ -162,7 +156,7 @@ func (d *DeploymentEvent) findAppsInCurrentDeploymentGroupApps(appIds map[apps.A
 	return foundApps
 }
 
-func (d *DeploymentEvent) findAppsInDeploymentChildGroups(appIds map[apps.AppId]struct{}, deployment *Deployments) []*apps.App {
+func (d *DeploymentEvent) findAppsInDeploymentChildGroups(appIds map[apps.AppID]struct{}, deployment *Deployments) []*apps.App {
 	foundApps := []*apps.App{}
 	searchForCount := len(appIds)
 
@@ -171,21 +165,19 @@ func (d *DeploymentEvent) findAppsInDeploymentChildGroups(appIds map[apps.AppId]
 			break
 		}
 		foundInChildGroup := d.findAppsInDeploymentsGroup(appIds, group)
-		for _, app := range foundInChildGroup {
-			foundApps = append(foundApps, app)
-		}
+		foundApps = append(foundApps, foundInChildGroup...)
 		searchForCount -= len(foundInChildGroup)
 	}
 	return foundApps
 }
 
-func (d *Deployments) filterCurrentGroupAppIds(appIds map[apps.AppId]struct{}) map[apps.AppId]struct{} {
-	filteredAppIds := make(map[apps.AppId]struct{})
+func (d *Deployments) filterCurrentGroupAppIds(appIds map[apps.AppID]struct{}) map[apps.AppID]struct{} {
+	filteredAppIds := make(map[apps.AppID]struct{})
 	var exists struct{}
 
-	for appId := range appIds {
-		if strings.HasPrefix(appId.String(), d.Id) {
-			filteredAppIds[appId] = exists
+	for appID := range appIds {
+		if strings.HasPrefix(appID.String(), d.ID) {
+			filteredAppIds[appID] = exists
 		}
 	}
 	return filteredAppIds
diff --git a/events/task_health_change.go b/events/task_health_change.go
index 514e6c7..f085e8b 100644
--- a/events/task_health_change.go
+++ b/events/task_health_change.go
@@ -8,9 +8,9 @@ import (
 
 type TaskHealthChange struct {
 	Timestamp  string      `json:"timestamp"`
-	ID         apps.TaskId `json:"id"`
+	ID         apps.TaskID `json:"id"`
 	TaskStatus string      `json:"taskStatus"`
-	AppID      apps.AppId  `json:"appId"`
+	AppID      apps.AppID  `json:"appId"`
 	Version    string      `json:"version"`
 	Alive      bool        `json:"alive"`
 }
diff --git a/events/unhealthy_task_kill.go b/events/unhealthy_task_kill.go
index ac4093b..771bde1 100644
--- a/events/unhealthy_task_kill.go
+++ b/events/unhealthy_task_kill.go
@@ -8,8 +8,8 @@ import (
 
 type UnhealthyTaskKilled struct {
 	Timestamp string      `json:"timestamp"`
-	ID        apps.TaskId `json:"taskId"`
-	AppID     apps.AppId  `json:"appId"`
+	ID        apps.TaskID `json:"taskId"`
+	AppID     apps.AppID  `json:"appId"`
 	Version   string      `json:"version"`
 }
 
diff --git a/marathon/marathon.go b/marathon/marathon.go
index 0f50e27..0c78418 100644
--- a/marathon/marathon.go
+++ b/marathon/marathon.go
@@ -16,8 +16,8 @@ import (
 
 type Marathoner interface {
 	ConsulApps() ([]*apps.App, error)
-	App(apps.AppId) (*apps.App, error)
-	Tasks(apps.AppId) ([]*apps.Task, error)
+	App(apps.AppID) (*apps.App, error)
+	Tasks(apps.AppID) ([]*apps.Task, error)
 	Leader() (string, error)
 }
 
@@ -56,10 +56,10 @@ func New(config Config) (*Marathon, error) {
 	}, nil
 }
 
-func (m Marathon) App(appId apps.AppId) (*apps.App, error) {
-	log.WithField("Location", m.Location).Debug("Asking Marathon for " + appId)
+func (m Marathon) App(appID apps.AppID) (*apps.App, error) {
+	log.WithField("Location", m.Location).Debug("Asking Marathon for " + appID)
 
-	body, err := m.get(m.urlWithQuery(fmt.Sprintf("/v2/apps/%s", appId), params{"embed": "apps.tasks"}))
+	body, err := m.get(m.urlWithQuery(fmt.Sprintf("/v2/apps/%s", appID), params{"embed": "apps.tasks"}))
 	if err != nil {
 		return nil, err
 	}
@@ -69,7 +69,7 @@ func (m Marathon) App(appId apps.AppId) (*apps.App, error) {
 
 func (m Marathon) ConsulApps() ([]*apps.App, error) {
 	log.WithField("Location", m.Location).Debug("Asking Marathon for apps")
-	body, err := m.get(m.urlWithQuery("/v2/apps", params{"embed": "apps.tasks", "label": apps.MARATHON_CONSUL_LABEL}))
+	body, err := m.get(m.urlWithQuery("/v2/apps", params{"embed": "apps.tasks", "label": apps.MarathonConsulLabel}))
 	if err != nil {
 		return nil, err
 	}
@@ -77,14 +77,14 @@ func (m Marathon) ConsulApps() ([]*apps.App, error) {
 	return apps.ParseApps(body)
 }
 
-func (m Marathon) Tasks(app apps.AppId) ([]*apps.Task, error) {
+func (m Marathon) Tasks(app apps.AppID) ([]*apps.Task, error) {
 	log.WithFields(log.Fields{
 		"Location": m.Location,
 		"Id":       app,
 	}).Debug("asking Marathon for tasks")
 
-	trimmedAppId := strings.Trim(app.String(), "/")
-	body, err := m.get(m.url(fmt.Sprintf("/v2/apps/%s/tasks", trimmedAppId)))
+	trimmedAppID := strings.Trim(app.String(), "/")
+	body, err := m.get(m.url(fmt.Sprintf("/v2/apps/%s/tasks", trimmedAppID)))
 	if err != nil {
 		return nil, err
 	}
@@ -140,7 +140,7 @@ func (m Marathon) get(url string) ([]byte, error) {
 }
 
 func (m Marathon) logHTTPError(resp *http.Response, err error) {
-	var statusCode string = "???"
+	statusCode := "???"
 	if resp != nil {
 		statusCode = fmt.Sprintf("%d", resp.StatusCode)
 	}
diff --git a/marathon/marathon_stub.go b/marathon/marathon_stub.go
index b623f9e..7eb1e28 100644
--- a/marathon/marathon_stub.go
+++ b/marathon/marathon_stub.go
@@ -1,15 +1,15 @@
 package marathon
 
 import (
-	"fmt"
+	"errors"
 
 	"github.com/allegro/marathon-consul/apps"
 )
 
 type MarathonerStub struct {
 	AppsStub     []*apps.App
-	AppStub      map[apps.AppId]*apps.App
-	TasksStub    map[apps.AppId][]*apps.Task
+	AppStub      map[apps.AppID]*apps.App
+	TasksStub    map[apps.AppID][]*apps.Task
 	leader       string
 	interactions bool
 }
@@ -19,22 +19,20 @@ func (m *MarathonerStub) ConsulApps() ([]*apps.App, error) {
 	return m.AppsStub, nil
 }
 
-func (m *MarathonerStub) App(id apps.AppId) (*apps.App, error) {
+func (m *MarathonerStub) App(id apps.AppID) (*apps.App, error) {
 	m.interactions = true
 	if app, ok := m.AppStub[id]; ok {
 		return app, nil
-	} else {
-		return nil, fmt.Errorf("app not found")
 	}
+	return nil, errors.New("app not found")
 }
 
-func (m *MarathonerStub) Tasks(appId apps.AppId) ([]*apps.Task, error) {
+func (m *MarathonerStub) Tasks(appID apps.AppID) ([]*apps.Task, error) {
 	m.interactions = true
-	if app, ok := m.TasksStub[appId]; ok {
+	if app, ok := m.TasksStub[appID]; ok {
 		return app, nil
-	} else {
-		return nil, fmt.Errorf("app not found")
 	}
+	return nil, errors.New("app not found")
 }
 
 func (m *MarathonerStub) Leader() (string, error) {
@@ -53,8 +51,8 @@ func MarathonerStubWithLeaderForApps(leader string, args ...*apps.App) *Marathon
 }
 
 func MarathonerStubForApps(args ...*apps.App) *MarathonerStub {
-	appsMap := make(map[apps.AppId]*apps.App)
-	tasksMap := make(map[apps.AppId][]*apps.Task)
+	appsMap := make(map[apps.AppID]*apps.App)
+	tasksMap := make(map[apps.AppID][]*apps.Task)
 
 	for _, app := range args {
 		appsMap[app.ID] = app
diff --git a/scripts/migrate_to_marathon_task_tag/main.go b/scripts/migrate_to_marathon_task_tag/main.go
index a61b760..c176a4d 100644
--- a/scripts/migrate_to_marathon_task_tag/main.go
+++ b/scripts/migrate_to_marathon_task_tag/main.go
@@ -112,7 +112,7 @@ func migrateServicesOnNode(services map[string]*api.AgentService, nodeClient *ap
 
 		if err := nodeClient.Agent().ServiceRegister(migrated(agentService)); err != nil {
 			log.WithError(err).WithField("ServiceID", agentService.ID).
-			Warn("Could not reregister service, skipping")
+				Warn("Could not reregister service, skipping")
 			stats.SkippedFailedServices++
 			continue
 		}
diff --git a/service/service.go b/service/service.go
index 09bb81b..52307e9 100644
--- a/service/service.go
+++ b/service/service.go
@@ -21,16 +21,16 @@ type Service struct {
 	RegisteringAgentAddress string
 }
 
-func (s *Service) TaskId() (apps.TaskId, error) {
+func (s *Service) TaskId() (apps.TaskID, error) {
 	for _, tag := range s.Tags {
 		if strings.HasPrefix(tag, "marathon-task:") {
-			return apps.TaskId(strings.TrimPrefix(tag, "marathon-task:")), nil
+			return apps.TaskID(strings.TrimPrefix(tag, "marathon-task:")), nil
 		}
 	}
-	return apps.TaskId(""), errors.New("marathon-task tag missing")
+	return apps.TaskID(""), errors.New("marathon-task tag missing")
 }
 
-func MarathonTaskTag(taskId apps.TaskId) string {
+func MarathonTaskTag(taskId apps.TaskID) string {
 	return fmt.Sprintf("marathon-task:%s", taskId)
 }
 
@@ -38,7 +38,7 @@ type ServiceRegistry interface {
 	GetAllServices() ([]*Service, error)
 	GetServices(name string) ([]*Service, error)
 	Register(task *apps.Task, app *apps.App) error
-	DeregisterByTask(taskId apps.TaskId) error
+	DeregisterByTask(taskId apps.TaskID) error
 	Deregister(toDeregister *Service) error
 	ServiceNames(app *apps.App) []string
 }
diff --git a/sync/config.go b/sync/config.go
index c240d97..57ea4db 100644
--- a/sync/config.go
+++ b/sync/config.go
@@ -4,7 +4,7 @@ import "time"
 
 type Config struct {
 	Enabled  bool
+	Force    bool
 	Interval time.Duration
 	Leader   string
-	Force    bool
 }
diff --git a/sync/sync.go b/sync/sync.go
index 000bf7b..456f998 100644
--- a/sync/sync.go
+++ b/sync/sync.go
@@ -16,14 +16,12 @@ type Sync struct {
 	config              Config
 	marathon            marathon.Marathoner
 	serviceRegistry     service.ServiceRegistry
-	syncStartedListener SyncStartedListener
+	syncStartedListener startedListener
 }
 
-type SyncStartedListener func(apps []*apps.App)
+type startedListener func(apps []*apps.App)
 
-var noopSyncStartedListener = func(apps []*apps.App) {}
-
-func New(config Config, marathon marathon.Marathoner, serviceRegistry service.ServiceRegistry, syncStartedListener SyncStartedListener) *Sync {
+func New(config Config, marathon marathon.Marathoner, serviceRegistry service.ServiceRegistry, syncStartedListener startedListener) *Sync {
 	return &Sync{config, marathon, serviceRegistry, syncStartedListener}
 }
 
@@ -41,14 +39,13 @@ func (s *Sync) StartSyncServicesJob() *time.Ticker {
 
 	ticker := time.NewTicker(s.config.Interval)
 	go func() {
-		s.SyncServices()
+		if err := s.SyncServices(); err != nil {
+			log.WithError(err).Error("An error occured while performing sync")
+		}
 		for {
-			select {
-			case <-ticker.C:
-				err := s.SyncServices()
-				if err != nil {
-					log.WithError(err).Error("An error occured while performing sync")
-				}
+			<-ticker.C
+			if err := s.SyncServices(); err != nil {
+				log.WithError(err).Error("An error occured while performing sync")
 			}
 		}
 	}()
@@ -121,14 +118,14 @@ func (s *Sync) resolveHostname() error {
 func (s *Sync) deregisterConsulServicesNotFoundInMarathon(marathonApps []*apps.App, services []*service.Service) {
 	runningTasks := s.marathonTaskIdsSet(marathonApps)
 	for _, service := range services {
-		taskIdInTag, err := service.TaskId()
-		taskIdNotFoundInTag := err != nil
-		if taskIdNotFoundInTag {
+		taskIDInTag, err := service.TaskId()
+		taskIDNotFoundInTag := err != nil
+		if taskIDNotFoundInTag {
 			log.WithField("Id", service.ID).WithError(err).
 				Warn("Couldn't extract marathon task id, deregistering to have sync reregister it properly")
 		}
 
-		if _, isRunning := runningTasks[taskIdInTag]; !isRunning || taskIdNotFoundInTag {
+		if _, isRunning := runningTasks[taskIDInTag]; !isRunning || taskIDNotFoundInTag {
 			err := s.serviceRegistry.Deregister(service)
 			if err != nil {
 				log.WithError(err).WithFields(log.Fields{
@@ -154,7 +151,7 @@ func (s *Sync) registerAppTasksNotFoundInConsul(marathonApps []*apps.App, servic
 			if registrations := registrationsUnderTaskIds[task.ID]; registrations != expectedRegistrations {
 				if registrations != 0 {
 					log.WithField("Id", task.ID).WithField("HasRegistrations", registrations).
-					WithField("ExpectedRegistrations", expectedRegistrations).Info("Registering missing service registrations")
+						WithField("ExpectedRegistrations", expectedRegistrations).Info("Registering missing service registrations")
 				}
 				if task.IsHealthy() {
 					err := s.serviceRegistry.Register(&task, app)
@@ -171,18 +168,18 @@ func (s *Sync) registerAppTasksNotFoundInConsul(marathonApps []*apps.App, servic
 	}
 }
 
-func (s *Sync) taskIdsInConsulServices(services []*service.Service) map[apps.TaskId]int {
-	serviceCounters := make(map[apps.TaskId]int)
+func (s *Sync) taskIdsInConsulServices(services []*service.Service) map[apps.TaskID]int {
+	serviceCounters := make(map[apps.TaskID]int)
 	for _, service := range services {
-		if taskId, err := service.TaskId(); err == nil {
-			serviceCounters[taskId] += 1
+		if taskID, err := service.TaskId(); err == nil {
+			serviceCounters[taskID]++
 		}
 	}
 	return serviceCounters
 }
 
-func (s *Sync) marathonTaskIdsSet(marathonApps []*apps.App) map[apps.TaskId]struct{} {
-	tasksSet := make(map[apps.TaskId]struct{})
+func (s *Sync) marathonTaskIdsSet(marathonApps []*apps.App) map[apps.TaskID]struct{} {
+	tasksSet := make(map[apps.TaskID]struct{})
 	var exists struct{}
 	for _, app := range marathonApps {
 		for _, task := range app.Tasks {
diff --git a/utils/apps.go b/utils/apps.go
index 30e9d42..76fb495 100644
--- a/utils/apps.go
+++ b/utils/apps.go
@@ -28,11 +28,11 @@ func app(name string, instances int, registrationsPerInstance int, consul bool,
 	for i := 0; i < instances; i++ {
 		var ports []int
 		for j := 1; j <= registrationsPerInstance; j++ {
-			ports = append(ports, 8080 + (i * j) + j - 1)
+			ports = append(ports, 8080+(i*j)+j-1)
 		}
 		task := apps.Task{
-			AppID: apps.AppId(name),
-			ID:    apps.TaskId(fmt.Sprintf("%s.%d", strings.Replace(strings.Trim(name, "/"), "/", "_", -1), i)),
+			AppID: apps.AppID(name),
+			ID:    apps.TaskID(fmt.Sprintf("%s.%d", strings.Replace(strings.Trim(name, "/"), "/", "_", -1), i)),
 			Ports: ports,
 			Host:  "localhost",
 		}
@@ -50,11 +50,11 @@ func app(name string, instances int, registrationsPerInstance int, consul bool,
 
 	labels := make(map[string]string)
 	if consul {
-		labels[apps.MARATHON_CONSUL_LABEL] = "true"
+		labels[apps.MarathonConsulLabel] = "true"
 	}
 
 	app := &apps.App{
-		ID:     apps.AppId(name),
+		ID:     apps.AppID(name),
 		Tasks:  appTasks,
 		Labels: labels,
 	}
@@ -62,7 +62,7 @@ func app(name string, instances int, registrationsPerInstance int, consul bool,
 	if registrationsPerInstance > 1 {
 		for i := 0; i < registrationsPerInstance; i++ {
 			app.PortDefinitions = append(app.PortDefinitions, apps.PortDefinition{
-				Port: 0,
+				Port:   0,
 				Labels: map[string]string{"consul": ""},
 			})
 		}
diff --git a/web/event_handler.go b/web/event_handler.go
index 74e9665..2c6f1e5 100644
--- a/web/event_handler.go
+++ b/web/event_handler.go
@@ -39,9 +39,9 @@ func newEventHandler(id int, serviceRegistry service.ServiceRegistry, marathon m
 }
 
 func (fh *eventHandler) Start() chan<- stopEvent {
-	var event event
+	var e event
 	process := func() {
-		err := fh.handleEvent(event.eventType, event.body)
+		err := fh.handleEvent(e.eventType, e.body)
 		if err != nil {
 			metrics.Mark("events.processing.error")
 		} else {
@@ -54,11 +54,11 @@ func (fh *eventHandler) Start() chan<- stopEvent {
 	go func() {
 		for {
 			select {
-			case event = <-fh.eventQueue:
+			case e = <-fh.eventQueue:
 				metrics.Mark(fmt.Sprintf("events.handler.%d", fh.id))
 				metrics.UpdateGauge("events.queue.len", int64(len(fh.eventQueue)))
-				metrics.UpdateGauge("events.queue.delay_ns", time.Since(event.timestamp).Nanoseconds())
-				metrics.Time("events.processing."+event.eventType, process)
+				metrics.UpdateGauge("events.queue.delay_ns", time.Since(e.timestamp).Nanoseconds())
+				metrics.Time("events.processing."+e.eventType, process)
 			case <-quitChan:
 				log.WithField("Id", fh.id).Info("Stopping worker")
 			}
@@ -69,7 +69,7 @@ func (fh *eventHandler) Start() chan<- stopEvent {
 
 func (fh *eventHandler) handleEvent(eventType string, body []byte) error {
 
-	body = replaceTaskIdWithId(body)
+	body = replaceTaskIDWithID(body)
 
 	switch eventType {
 	case "status_update_event":
@@ -106,8 +106,8 @@ func (fh *eventHandler) handleHealthStatusEvent(body []byte) error {
 		return nil
 	}
 
-	appId := taskHealthChange.AppID
-	app, err := fh.marathon.App(appId)
+	appID := taskHealthChange.AppID
+	app, err := fh.marathon.App(appID)
 	if err != nil {
 		log.WithField("Id", taskHealthChange.ID).WithError(err).Error("There was a problem obtaining app info")
 		return err
@@ -121,7 +121,7 @@ func (fh *eventHandler) handleHealthStatusEvent(body []byte) error {
 
 	tasks := app.Tasks
 
-	task, err := findTaskById(taskHealthChange.ID, tasks)
+	task, err := findTaskByID(taskHealthChange.ID, tasks)
 	if err != nil {
 		log.WithField("Id", taskHealthChange.ID).WithError(err).Error("Task not found")
 		return err
@@ -132,13 +132,11 @@ func (fh *eventHandler) handleHealthStatusEvent(body []byte) error {
 		if err != nil {
 			log.WithField("Id", task.ID).WithError(err).Error("There was a problem registering task")
 			return err
-		} else {
-			return nil
 		}
-	} else {
-		log.WithField("Id", task.ID).Debug("Task is not healthy. Not registering")
 		return nil
 	}
+	log.WithField("Id", task.ID).Debug("Task is not healthy. Not registering")
+	return nil
 }
 
 func (fh *eventHandler) handleStatusEvent(body []byte) error {
@@ -192,9 +190,7 @@ func (fh *eventHandler) handleDeploymentInfo(body []byte) error {
 
 	errors := []error{}
 	for _, app := range deploymentEvent.StoppedConsulApps() {
-		for _, err = range fh.deregisterAllAppServices(app) {
-			errors = append(errors, err)
-		}
+		errors = append(errors, fh.deregisterAllAppServices(app)...)
 	}
 	return utils.MergeErrorsOrNil(errors, "handling deregistration")
 }
@@ -210,9 +206,7 @@ func (fh *eventHandler) handleDeploymentStepSuccess(body []byte) error {
 
 	errors := []error{}
 	for _, app := range deploymentEvent.RenamedConsulApps() {
-		for _, err = range fh.deregisterAllAppServices(app) {
-			errors = append(errors, err)
-		}
+		errors = append(errors, fh.deregisterAllAppServices(app)...)
 	}
 	return utils.MergeErrorsOrNil(errors, "handling deregistration")
 }
@@ -240,13 +234,13 @@ func (fh *eventHandler) deregisterAllAppServices(app *apps.App) []error {
 	}
 
 	for _, service := range allServices {
-		taskId, err := service.TaskId()
+		taskID, err := service.TaskId()
 		if err != nil {
 			errors = append(errors, err)
 			continue
 		}
-		if taskId.AppId() == app.ID {
-			err = fh.deregister(taskId)
+		if taskID.AppID() == app.ID {
+			err = fh.deregister(taskID)
 			if err != nil {
 				errors = append(errors, err)
 			}
@@ -255,16 +249,16 @@ func (fh *eventHandler) deregisterAllAppServices(app *apps.App) []error {
 	return errors
 }
 
-func (fh *eventHandler) deregister(taskId apps.TaskId) error {
-	err := fh.serviceRegistry.DeregisterByTask(taskId)
+func (fh *eventHandler) deregister(taskID apps.TaskID) error {
+	err := fh.serviceRegistry.DeregisterByTask(taskID)
 	if err != nil {
-		log.WithField("Id", taskId).WithError(err).Error("There was a problem deregistering task")
+		log.WithField("Id", taskID).WithError(err).Error("There was a problem deregistering task")
 	}
 	return err
 }
 
-func findTaskById(id apps.TaskId, tasks_ []apps.Task) (apps.Task, error) {
-	for _, task := range tasks_ {
+func findTaskByID(id apps.TaskID, tasks []apps.Task) (apps.Task, error) {
+	for _, task := range tasks {
 		if task.ID == id {
 			return task, nil
 		}
@@ -276,6 +270,6 @@ func findTaskById(id apps.TaskId, tasks_ []apps.Task) (apps.Task, error) {
 // Here, it uses "taskId", with most of the other fields being equal. We'll
 // just swap "taskId" for "id" in the body so that we can successfully parse
 // incoming events.
-func replaceTaskIdWithId(body []byte) []byte {
+func replaceTaskIDWithID(body []byte) []byte {
 	return bytes.Replace(body, []byte("taskId"), []byte("id"), -1)
 }
diff --git a/web/web_handler.go b/web/web_handler.go
index 0788504..4439019 100644
--- a/web/web_handler.go
+++ b/web/web_handler.go
@@ -12,15 +12,15 @@ import (
 	"github.com/allegro/marathon-consul/metrics"
 )
 
-type WebHandler struct {
+type EventHandler struct {
 	eventQueue chan event
 }
 
-func newWebHandler(eventQueue chan event) *WebHandler {
-	return &WebHandler{eventQueue: eventQueue}
+func newWebHandler(eventQueue chan event) *EventHandler {
+	return &EventHandler{eventQueue: eventQueue}
 }
 
-func (h *WebHandler) Handle(w http.ResponseWriter, r *http.Request) {
+func (h *EventHandler) Handle(w http.ResponseWriter, r *http.Request) {
 	metrics.Time("events.response", func() {
 		body, err := ioutil.ReadAll(r.Body)
 		if err != nil {


Test patch:
diff --git a/apps/app_test.go b/apps/app_test.go
index 6d9e57c..ec0e192 100644
--- a/apps/app_test.go
+++ b/apps/app_test.go
@@ -117,11 +117,11 @@ func TestConsulApp(t *testing.T) {
 
 func TestAppId_String(t *testing.T) {
 	t.Parallel()
-	assert.Equal(t, "appId", AppId("appId").String())
+	assert.Equal(t, "appId", AppID("appId").String())
 }
 
 var dummyTask = &Task{
-	ID:    TaskId("some-task"),
+	ID:    TaskID("some-task"),
 	Ports: []int{1337},
 }
 
@@ -212,10 +212,10 @@ func TestRegistrationIntent_NoOverrideViaPortDefinitionsIfNoConsulLabelThere(t *
 		ID:     "app-name",
 		Labels: map[string]string{"consul": "true", "private": "tag"},
 		PortDefinitions: []PortDefinition{
-			PortDefinition{
+			{
 				Labels: map[string]string{"other": "tag"},
 			},
-			PortDefinition{},
+			{},
 		},
 	}
 	task := &Task{
@@ -240,10 +240,10 @@ func TestRegistrationIntent_OverrideNameAndAddTagsViaPortDefinitions(t *testing.
 		ID:     "app-name",
 		Labels: map[string]string{"consul": "true", "private": "tag"},
 		PortDefinitions: []PortDefinition{
-			PortDefinition{
+			{
 				Labels: map[string]string{"consul": "other-name", "other": "tag"},
 			},
-			PortDefinition{},
+			{},
 		},
 	}
 	task := &Task{
@@ -268,8 +268,8 @@ func TestRegistrationIntent_PickDifferentPortViaPortDefinitions(t *testing.T) {
 		ID:     "app-name",
 		Labels: map[string]string{"consul": "true", "private": "tag"},
 		PortDefinitions: []PortDefinition{
-			PortDefinition{},
-			PortDefinition{
+			{},
+			{
 				Labels: map[string]string{"consul": "true"},
 			},
 		},
@@ -293,7 +293,7 @@ func TestRegistrationIntent_PickExplicitPortViaPortDefinitions(t *testing.T) {
 		ID:     "app-name",
 		Labels: map[string]string{"consul": "true", "private": "tag"},
 		PortDefinitions: []PortDefinition{
-			PortDefinition{
+			{
 				Port:   1337,
 				Labels: map[string]string{"consul": "true"},
 			},
@@ -318,10 +318,10 @@ func TestRegistrationIntent_MultipleIntentsViaPortDefinitionIfMultipleContainCon
 		ID:     "app-name",
 		Labels: map[string]string{"consul": "true", "common-tag": "tag"},
 		PortDefinitions: []PortDefinition{
-			PortDefinition{
+			{
 				Labels: map[string]string{"consul": "first-name", "first-tag": "tag"},
 			},
-			PortDefinition{
+			{
 				Labels: map[string]string{"consul": "second-name", "second-tag": "tag"},
 			},
 		},
@@ -364,10 +364,10 @@ func TestConsulNames_WithPortDefinitions(t *testing.T) {
 		ID:     "context/app-name",
 		Labels: map[string]string{"consul": ""},
 		PortDefinitions: []PortDefinition{
-			PortDefinition{
+			{
 				Labels: map[string]string{"consul": "some/name"},
 			},
-			PortDefinition{
+			{
 				Labels: map[string]string{"consul": "yet-another/name"},
 			},
 		},
@@ -433,7 +433,7 @@ func TestHasSameConsulNamesAs_SameConfigsWithPortDefinitions(t *testing.T) {
 		ID:     "app-name",
 		Labels: map[string]string{"consul": "true"},
 		PortDefinitions: []PortDefinition{
-			PortDefinition{
+			{
 				Labels: map[string]string{"consul": "true"},
 			},
 		},
@@ -451,7 +451,7 @@ func TestHasSameConsulNamesAs_DifferentConfigsSameNamesWithPortDefinitions(t *te
 		ID:     "app-name",
 		Labels: map[string]string{"consul": "true"},
 		PortDefinitions: []PortDefinition{
-			PortDefinition{
+			{
 				Labels: map[string]string{"consul": "true"},
 			},
 		},
@@ -460,7 +460,7 @@ func TestHasSameConsulNamesAs_DifferentConfigsSameNamesWithPortDefinitions(t *te
 		ID:     "app-name",
 		Labels: map[string]string{"consul": "true"},
 		PortDefinitions: []PortDefinition{
-			PortDefinition{
+			{
 				Labels: map[string]string{"consul": "app-name"},
 			},
 		},
@@ -479,7 +479,7 @@ func TestHasSameConsulNamesAs_DifferentConfigsDifferentNamesWithPortDefinitions(
 		ID:     "app-name",
 		Labels: map[string]string{"consul": "true"},
 		PortDefinitions: []PortDefinition{
-			PortDefinition{
+			{
 				Labels: map[string]string{"consul": "some-name"},
 			},
 		},
@@ -488,7 +488,7 @@ func TestHasSameConsulNamesAs_DifferentConfigsDifferentNamesWithPortDefinitions(
 		ID:     "app-name",
 		Labels: map[string]string{"consul": "true"},
 		PortDefinitions: []PortDefinition{
-			PortDefinition{
+			{
 				Labels: map[string]string{"consul": "other-name"},
 			},
 		},
@@ -506,7 +506,7 @@ func TestHasSameConsulNamesAs_DifferentConfigsDifferentNumberOfRegitrationsWithP
 		ID:     "app-name",
 		Labels: map[string]string{"consul": "true"},
 		PortDefinitions: []PortDefinition{
-			PortDefinition{
+			{
 				Labels: map[string]string{"consul": "some-name"},
 			},
 		},
@@ -515,10 +515,10 @@ func TestHasSameConsulNamesAs_DifferentConfigsDifferentNumberOfRegitrationsWithP
 		ID:     "app-name",
 		Labels: map[string]string{"consul": "true"},
 		PortDefinitions: []PortDefinition{
-			PortDefinition{
+			{
 				Labels: map[string]string{"consul": "some-name"},
 			},
-			PortDefinition{
+			{
 				Labels: map[string]string{"consul": "yet-another-name"},
 			},
 		},
@@ -545,7 +545,7 @@ func TestRegistrationIntentsNumber_NoPortDefinitions(t *testing.T) {
 
 	// given
 	app := &App{
-		ID: "id",
+		ID:     "id",
 		Labels: map[string]string{"consul": ""},
 	}
 
@@ -561,7 +561,7 @@ func TestRegistrationIntentsNumber_SinglePortDefinitions(t *testing.T) {
 		ID:     "id",
 		Labels: map[string]string{"consul": ""},
 		PortDefinitions: []PortDefinition{
-			PortDefinition{
+			{
 				Labels: map[string]string{"consul": ""},
 			},
 		},
@@ -579,10 +579,10 @@ func TestRegistrationIntentsNumber_MultiplePortDefinitions(t *testing.T) {
 		ID:     "id",
 		Labels: map[string]string{"consul": ""},
 		PortDefinitions: []PortDefinition{
-			PortDefinition{
+			{
 				Labels: map[string]string{"consul": ""},
 			},
-			PortDefinition{
+			{
 				Labels: map[string]string{"consul": ""},
 			},
 		},
diff --git a/apps/task_test.go b/apps/task_test.go
index a08a10c..da48621 100644
--- a/apps/task_test.go
+++ b/apps/task_test.go
@@ -106,16 +106,16 @@ func TestIsHealthy(t *testing.T) {
 
 func TestId_String(t *testing.T) {
 	t.Parallel()
-	assert.Equal(t, "id", TaskId("id").String())
+	assert.Equal(t, "id", TaskID("id").String())
 }
 
 func TestId_AppId(t *testing.T) {
 	t.Parallel()
 	id := "pl.allegro_test_app.a7cde60e-0093-11e6-ab55-02aab772a161"
-	assert.Equal(t, AppId("/pl.allegro/test/app"), TaskId(id).AppId())
+	assert.Equal(t, AppID("/pl.allegro/test/app"), TaskID(id).AppID())
 }
 
 func TestId_AppIdForInvalid(t *testing.T) {
 	t.Parallel()
-	assert.Panics(t, func() { TaskId("id").AppId() })
+	assert.Panics(t, func() { TaskID("id").AppID() })
 }
diff --git a/config/config_test.go b/config/config_test.go
index 7ee4048..2ef4506 100644
--- a/config/config_test.go
+++ b/config/config_test.go
@@ -85,7 +85,7 @@ func TestConfig_ShouldUseTextFormatterWhenFormatterIsUnknown(t *testing.T) {
 func TestConfig_ShouldBeMergedWithFileDefaultsAndFlags(t *testing.T) {
 	clear()
 	expected := &Config{
-		Consul: consul.ConsulConfig{
+		Consul: consul.Config{
 			Auth: consul.Auth{Enabled: false,
 				Username: "",
 				Password: ""},
diff --git a/consul/agents_test.go b/consul/agents_test.go
index 438dd20..bad8cbe 100644
--- a/consul/agents_test.go
+++ b/consul/agents_test.go
@@ -10,7 +10,7 @@ import (
 func TestGetAgent(t *testing.T) {
 	t.Parallel()
 	// given
-	agents := NewAgents(&ConsulConfig{})
+	agents := NewAgents(&Config{})
 
 	// when
 	agent, err := agents.GetAgent("127.0.0.1")
@@ -23,7 +23,7 @@ func TestGetAgent(t *testing.T) {
 func TestGetAnyAgent_SingleAgentAvailable(t *testing.T) {
 	t.Parallel()
 	// given
-	agents := NewAgents(&ConsulConfig{})
+	agents := NewAgents(&Config{})
 
 	// when
 	agents.GetAgent("127.0.0.1") // create
@@ -38,7 +38,7 @@ func TestGetAnyAgent_SingleAgentAvailable(t *testing.T) {
 func TestGetAnyAgent(t *testing.T) {
 	t.Parallel()
 	// given
-	agents := NewAgents(&ConsulConfig{})
+	agents := NewAgents(&Config{})
 	agent1, _ := agents.GetAgent("127.0.0.1")
 	agent2, _ := agents.GetAgent("127.0.0.2")
 	agent3, _ := agents.GetAgent("127.0.0.3")
@@ -54,7 +54,7 @@ func TestGetAnyAgent(t *testing.T) {
 func TestGetAgent_ShouldResolveAddressToIP(t *testing.T) {
 	t.Parallel()
 	// given
-	agents := NewAgents(&ConsulConfig{})
+	agents := NewAgents(&Config{})
 
 	// when
 	agent1, _ := agents.GetAgent("127.0.0.1")
@@ -67,7 +67,7 @@ func TestGetAgent_ShouldResolveAddressToIP(t *testing.T) {
 func TestGetAgent_ShouldFailOnWrongHostname(t *testing.T) {
 	t.Parallel()
 	// given
-	agents := NewAgents(&ConsulConfig{})
+	agents := NewAgents(&Config{})
 
 	// when
 	_, err := agents.GetAgent("wrong hostname")
@@ -79,7 +79,7 @@ func TestGetAgent_ShouldFailOnWrongHostname(t *testing.T) {
 func TestGetAgent_ShouldFailOnUnknownHostname(t *testing.T) {
 	t.Parallel()
 	// given
-	agents := NewAgents(&ConsulConfig{})
+	agents := NewAgents(&Config{})
 
 	// when
 	_, err := agents.GetAgent("unknown.host.name.1")
@@ -91,7 +91,7 @@ func TestGetAgent_ShouldFailOnUnknownHostname(t *testing.T) {
 func TestGetAnyAgent_shouldFailOnNoAgentAvailable(t *testing.T) {
 	t.Parallel()
 	// given
-	agents := NewAgents(&ConsulConfig{})
+	agents := NewAgents(&Config{})
 
 	// when
 	anyAgent, err := agents.GetAnyAgent()
@@ -104,7 +104,7 @@ func TestGetAnyAgent_shouldFailOnNoAgentAvailable(t *testing.T) {
 func TestRemoveAgent(t *testing.T) {
 	t.Parallel()
 	// given
-	agents := NewAgents(&ConsulConfig{})
+	agents := NewAgents(&Config{})
 	agents.GetAgent("127.0.0.1")
 	agent2, _ := agents.GetAgent("127.0.0.2")
 
@@ -123,7 +123,7 @@ func TestRemoveAgent(t *testing.T) {
 func TestRemoveAgentTwiceShouldPass(t *testing.T) {
 	t.Parallel()
 	// given
-	agents := NewAgents(&ConsulConfig{})
+	agents := NewAgents(&Config{})
 	agents.GetAgent("127.0.0.1")
 
 	// when
diff --git a/consul/consul_stub_test.go b/consul/consul_stub_test.go
index 955b209..935916a 100644
--- a/consul/consul_stub_test.go
+++ b/consul/consul_stub_test.go
@@ -39,16 +39,16 @@ func TestConsulStub(t *testing.T) {
 	// when
 	err = consul.DeregisterByTask(app.Tasks[1].ID)
 	services, _ = consul.GetAllServices()
-	taskIds := consul.RegisteredTaskIds()
+	taskIds := consul.RegisteredTaskIDs()
 
 	// then
 	assert.NoError(t, err)
 	assert.Len(t, services, 2)
-	assert.Contains(t, taskIds, apps.TaskId("test.0"))
-	assert.Contains(t, taskIds, apps.TaskId("test.2"))
+	assert.Contains(t, taskIds, apps.TaskID("test.0"))
+	assert.Contains(t, taskIds, apps.TaskID("test.2"))
 
 	// given
-	consul.FailDeregisterByTaskForId(app.Tasks[0].ID)
+	consul.FailDeregisterByTaskForID(app.Tasks[0].ID)
 
 	// when
 	err = consul.DeregisterByTask(app.Tasks[0].ID)
@@ -57,7 +57,7 @@ func TestConsulStub(t *testing.T) {
 	assert.Error(t, err)
 
 	// given
-	consul.FailRegisterForId(app.Tasks[0].ID)
+	consul.FailRegisterForID(app.Tasks[0].ID)
 
 	// when
 	err = consul.Register(&app.Tasks[0], app)
@@ -70,7 +70,7 @@ func TestConsulStub(t *testing.T) {
 
 	// then
 	assert.NoError(t, err)
-	assert.Len(t, consul.RegisteredTaskIds(), 1)
+	assert.Len(t, consul.RegisteredTaskIDs(), 1)
 
 	// when
 	app = utils.ConsulApp("other", 2)
diff --git a/consul/consul_test.go b/consul/consul_test.go
index a79b13a..e970529 100644
--- a/consul/consul_test.go
+++ b/consul/consul_test.go
@@ -15,7 +15,7 @@ import (
 func TestGetAgent_WithEmptyHost(t *testing.T) {
 	t.Parallel()
 	// given
-	agents := NewAgents(&ConsulConfig{})
+	agents := NewAgents(&Config{})
 	// when
 	agent, err := agents.GetAgent("")
 	// then
@@ -27,7 +27,7 @@ func TestGetAgent_FullConfig(t *testing.T) {
 	t.Parallel()
 
 	// given
-	agents := NewAgents(&ConsulConfig{Token: "token", SslEnabled: true,
+	agents := NewAgents(&Config{Token: "token", SslEnabled: true,
 		Auth: Auth{Enabled: true, Username: "", Password: ""}, Timeout: time.Second})
 
 	// when
@@ -42,7 +42,7 @@ func TestGetAllServices_ForEmptyAgents(t *testing.T) {
 	t.Parallel()
 
 	// given
-	consul := New(ConsulConfig{})
+	consul := New(Config{})
 
 	// when
 	services, err := consul.GetAllServices()
@@ -56,7 +56,7 @@ func TestRegister_ForInvalidHost(t *testing.T) {
 	t.Parallel()
 
 	// given
-	consul := New(ConsulConfig{})
+	consul := New(Config{})
 	app := utils.ConsulApp("serviceA", 1)
 
 	// when
@@ -80,16 +80,16 @@ func TestRegister_ForInvalidHost(t *testing.T) {
 func TestGetServices(t *testing.T) {
 	t.Parallel()
 	// create cluster of 2 consul servers
-	server1 := CreateConsulTestServer(t)
+	server1 := CreateTestServer(t)
 	defer server1.Stop()
 
-	server2 := CreateConsulTestServer(t)
+	server2 := CreateTestServer(t)
 	defer server2.Stop()
 
 	server1.JoinWAN(server2.LANAddr)
 
 	// create client
-	consul := ConsulClientAtServer(server1)
+	consul := ClientAtServer(server1)
 	consul.config.Tag = "marathon"
 
 	// given
@@ -118,11 +118,11 @@ func TestGetServices(t *testing.T) {
 
 func TestGetService_FailingAgent_GivingUp(t *testing.T) {
 	t.Parallel()
-	server1 := CreateConsulTestServer(t)
+	server1 := CreateTestServer(t)
 	defer server1.Stop()
 
 	// create client
-	consul := FailingConsulClient()
+	consul := FailingClient()
 
 	// when
 	services, err := consul.GetServices("serviceA")
@@ -135,11 +135,11 @@ func TestGetService_FailingAgent_GivingUp(t *testing.T) {
 func TestGetServices_RemovingFailingAgentsAndRetrying(t *testing.T) {
 	t.Parallel()
 	// create server
-	server1 := CreateConsulTestServer(t)
+	server1 := CreateTestServer(t)
 	defer server1.Stop()
 
 	// create client
-	consul := ConsulClientAtServer(server1)
+	consul := ClientAtServer(server1)
 	consul.config.Tag = "marathon"
 	consul.config.RequestRetries = 100
 
@@ -163,16 +163,16 @@ func TestGetServices_RemovingFailingAgentsAndRetrying(t *testing.T) {
 func TestGetServices_SelectOnlyTaggedServices(t *testing.T) {
 	t.Parallel()
 	// create cluster of 2 consul servers
-	server1 := CreateConsulTestServer(t)
+	server1 := CreateTestServer(t)
 	defer server1.Stop()
 
-	server2 := CreateConsulTestServer(t)
+	server2 := CreateTestServer(t)
 	defer server2.Stop()
 
 	server1.JoinWAN(server2.LANAddr)
 
 	// create client
-	consul := ConsulClientAtServer(server1)
+	consul := ClientAtServer(server1)
 	consul.config.Tag = "marathon-mycluster"
 
 	// given
@@ -203,16 +203,16 @@ func TestGetServices_SelectOnlyTaggedServices(t *testing.T) {
 func TestGetAllServices(t *testing.T) {
 	t.Parallel()
 	// create cluster of 2 consul servers
-	server1 := CreateConsulTestServer(t)
+	server1 := CreateTestServer(t)
 	defer server1.Stop()
 
-	server2 := CreateConsulTestServer(t)
+	server2 := CreateTestServer(t)
 	defer server2.Stop()
 
 	server1.JoinWAN(server2.LANAddr)
 
 	// create client
-	consul := ConsulClientAtServer(server1)
+	consul := ClientAtServer(server1)
 	consul.config.Tag = "marathon"
 
 	// given
@@ -242,11 +242,11 @@ func TestGetAllServices(t *testing.T) {
 
 func TestGetServicesUsingProviderWithRetriesOnAgentFailure_ShouldRetryConfiguredNumberOfTimes(t *testing.T) {
 	t.Parallel()
-	server1 := CreateConsulTestServer(t)
+	server1 := CreateTestServer(t)
 	defer server1.Stop()
 
 	// create client
-	consul := ConsulClientAtServer(server1)
+	consul := ClientAtServer(server1)
 	consul.config.AgentFailuresTolerance = 2
 	consul.config.RequestRetries = 4
 
@@ -269,11 +269,11 @@ func TestGetServicesUsingProviderWithRetriesOnAgentFailure_ShouldRetryConfigured
 
 func TestGetAllServices_FailingAgent_GivingUp(t *testing.T) {
 	t.Parallel()
-	server1 := CreateConsulTestServer(t)
+	server1 := CreateTestServer(t)
 	defer server1.Stop()
 
 	// create client
-	consul := FailingConsulClient()
+	consul := FailingClient()
 
 	// when
 	services, err := consul.GetAllServices()
@@ -286,16 +286,16 @@ func TestGetAllServices_FailingAgent_GivingUp(t *testing.T) {
 func TestGetAllServices_RemovingFailingAgentsAndRetrying(t *testing.T) {
 	t.Parallel()
 	// create cluster of 2 consul servers
-	server1 := CreateConsulTestServer(t)
+	server1 := CreateTestServer(t)
 	defer server1.Stop()
 
-	server2 := CreateConsulTestServer(t)
+	server2 := CreateTestServer(t)
 	defer server2.Stop()
 
 	server1.JoinWAN(server2.LANAddr)
 
 	// create client
-	consul := ConsulClientAtServer(server1)
+	consul := ClientAtServer(server1)
 	consul.config.Tag = "marathon"
 	consul.config.RequestRetries = 100
 
@@ -331,10 +331,10 @@ func TestGetAllServices_RemovingFailingAgentsAndRetrying(t *testing.T) {
 
 func TestRegisterServices(t *testing.T) {
 	t.Parallel()
-	server := CreateConsulTestServer(t)
+	server := CreateTestServer(t)
 	defer server.Stop()
 
-	consul := ConsulClientAtServer(server)
+	consul := ClientAtServer(server)
 	consul.config.Tag = "marathon"
 
 	// given
@@ -359,10 +359,10 @@ func TestRegisterServices(t *testing.T) {
 
 func TestRegisterServices_CustomServiceName(t *testing.T) {
 	t.Parallel()
-	server := CreateConsulTestServer(t)
+	server := CreateTestServer(t)
 	defer server.Stop()
 
-	consul := ConsulClientAtServer(server)
+	consul := ClientAtServer(server)
 	consul.config.Tag = "marathon"
 
 	// given
@@ -387,19 +387,19 @@ func TestRegisterServices_CustomServiceName(t *testing.T) {
 
 func TestRegisterServices_MultipleRegistrations(t *testing.T) {
 	t.Parallel()
-	server := CreateConsulTestServer(t)
+	server := CreateTestServer(t)
 	defer server.Stop()
 
-	consul := ConsulClientAtServer(server)
+	consul := ClientAtServer(server)
 	consul.config.Tag = "marathon"
 
 	// given
 	app := utils.ConsulApp("serviceA", 1)
 	app.PortDefinitions = []apps.PortDefinition{
-		apps.PortDefinition{
+		{
 			Labels: map[string]string{"consul": "first-name", "first-tag": "tag"},
 		},
-		apps.PortDefinition{
+		{
 			Labels: map[string]string{"consul": "second-name", "second-tag": "tag"},
 		},
 	}
@@ -441,10 +441,10 @@ func findServiceByName(name string, services []*service.Service) (*service.Servi
 
 func TestRegisterServices_InvalidHostnameShouldFail(t *testing.T) {
 	t.Parallel()
-	server := CreateConsulTestServer(t)
+	server := CreateTestServer(t)
 	defer server.Stop()
 
-	consul := ConsulClientAtServer(server)
+	consul := ClientAtServer(server)
 	consul.config.Tag = "marathon"
 
 	// given
@@ -461,10 +461,10 @@ func TestRegisterServices_InvalidHostnameShouldFail(t *testing.T) {
 
 func TestRegisterServices_InvalidCustomServiceName(t *testing.T) {
 	t.Parallel()
-	server := CreateConsulTestServer(t)
+	server := CreateTestServer(t)
 	defer server.Stop()
 
-	consul := ConsulClientAtServer(server)
+	consul := ClientAtServer(server)
 	consul.config.Tag = "marathon"
 
 	// given
@@ -491,7 +491,7 @@ func TestRegisterServices_shouldReturnErrorOnFailure(t *testing.T) {
 	t.Parallel()
 
 	// given
-	consul := New(ConsulConfig{Port: "1234"})
+	consul := New(Config{Port: "1234"})
 	app := utils.ConsulApp("serviceA", 1)
 
 	// when
@@ -503,10 +503,10 @@ func TestRegisterServices_shouldReturnErrorOnFailure(t *testing.T) {
 
 func TestDeregisterServices(t *testing.T) {
 	t.Parallel()
-	server := CreateConsulTestServer(t)
+	server := CreateTestServer(t)
 	defer server.Stop()
 
-	consul := ConsulClientAtServer(server)
+	consul := ClientAtServer(server)
 	consul.config.Tag = "marathon"
 
 	// given
@@ -527,9 +527,9 @@ func TestDeregisterServices(t *testing.T) {
 
 func TestDeregisterServices_shouldReturnErrorOnFailure(t *testing.T) {
 	t.Parallel()
-	server := CreateConsulTestServer(t)
+	server := CreateTestServer(t)
 
-	consul := ConsulClientAtServer(server)
+	consul := ClientAtServer(server)
 	consul.config.Tag = "marathon"
 
 	// given
@@ -546,10 +546,10 @@ func TestDeregisterServices_shouldReturnErrorOnFailure(t *testing.T) {
 
 func TestDeregisterServicesByTask(t *testing.T) {
 	t.Parallel()
-	server := CreateConsulTestServer(t)
+	server := CreateTestServer(t)
 	defer server.Stop()
 
-	consul := ConsulClientAtServer(server)
+	consul := ClientAtServer(server)
 	consul.config.Tag = "marathon"
 
 	// given
@@ -557,7 +557,7 @@ func TestDeregisterServicesByTask(t *testing.T) {
 	task := app.Tasks[0]
 
 	server.AddService("serviceA", "passing", []string{"marathon", service.MarathonTaskTag(task.ID)})
-	server.AddService("serviceB", "passing", []string{"marathon", service.MarathonTaskTag(apps.TaskId("other"))})
+	server.AddService("serviceB", "passing", []string{"marathon", service.MarathonTaskTag(apps.TaskID("other"))})
 	services, _ := consul.GetAllServices()
 	assert.Len(t, services, 2)
 
@@ -572,9 +572,9 @@ func TestDeregisterServicesByTask(t *testing.T) {
 
 func TestDeregisterServicesByTask_shouldReturnErrorOnFailure(t *testing.T) {
 	t.Parallel()
-	server := CreateConsulTestServer(t)
+	server := CreateTestServer(t)
 
-	consul := ConsulClientAtServer(server)
+	consul := ClientAtServer(server)
 	consul.config.Tag = "marathon"
 
 	// given
@@ -593,10 +593,10 @@ func TestDeregisterServicesByTask_shouldReturnErrorOnFailure(t *testing.T) {
 
 func TestDeregisterServicesByTask_shouldReturnErrorOnServiceMatchingTaskNotFound(t *testing.T) {
 	t.Parallel()
-	server := CreateConsulTestServer(t)
+	server := CreateTestServer(t)
 	defer server.Stop()
 
-	consul := ConsulClientAtServer(server)
+	consul := ClientAtServer(server)
 	consul.config.Tag = "marathon"
 
 	// given
@@ -604,7 +604,7 @@ func TestDeregisterServicesByTask_shouldReturnErrorOnServiceMatchingTaskNotFound
 	task := app.Tasks[0]
 
 	server.AddService("serviceA", "passing", []string{"marathon", service.MarathonTaskTag(task.ID)})
-	server.AddService("serviceB", "passing", []string{"marathon", service.MarathonTaskTag(apps.TaskId("other"))})
+	server.AddService("serviceB", "passing", []string{"marathon", service.MarathonTaskTag(apps.TaskID("other"))})
 	services, _ := consul.GetAllServices()
 	assert.Len(t, services, 2)
 
@@ -619,10 +619,10 @@ func TestDeregisterServicesByTask_shouldReturnErrorOnServiceMatchingTaskNotFound
 
 func TestDeregisterServicesByTask_shouldDeregisterAllMatchingServicesWhenMultipleMatchGivenTaskId(t *testing.T) {
 	t.Parallel()
-	server := CreateConsulTestServer(t)
+	server := CreateTestServer(t)
 	defer server.Stop()
 
-	consul := ConsulClientAtServer(server)
+	consul := ClientAtServer(server)
 	consul.config.Tag = "marathon"
 
 	// given
@@ -631,7 +631,7 @@ func TestDeregisterServicesByTask_shouldDeregisterAllMatchingServicesWhenMultipl
 
 	server.AddService("serviceA", "passing", []string{"marathon", service.MarathonTaskTag(task.ID)})
 	server.AddService("serviceA-bis", "passing", []string{"marathon", service.MarathonTaskTag(task.ID)})
-	server.AddService("serviceB", "passing", []string{"marathon", service.MarathonTaskTag(apps.TaskId("other"))})
+	server.AddService("serviceB", "passing", []string{"marathon", service.MarathonTaskTag(apps.TaskID("other"))})
 	services, _ := consul.GetAllServices()
 	assert.Len(t, services, 3)
 
@@ -646,11 +646,11 @@ func TestDeregisterServicesByTask_shouldDeregisterAllMatchingServicesWhenMultipl
 
 func TestAddAgentsFromApp(t *testing.T) {
 	t.Parallel()
-	server := CreateConsulTestServer(t)
+	server := CreateTestServer(t)
 	defer server.Stop()
 
 	// create consul without any agents in cache
-	consul := New(ConsulConfig{
+	consul := New(Config{
 		Timeout:             10 * time.Millisecond,
 		Port:                fmt.Sprintf("%d", server.Config.Ports.HTTP),
 		ConsulNameSeparator: ".",
@@ -675,7 +675,7 @@ func TestMarathonTaskToConsulServiceMapping(t *testing.T) {
 	t.Parallel()
 
 	// given
-	consul := New(ConsulConfig{Tag: "marathon"})
+	consul := New(Config{Tag: "marathon"})
 	app := &apps.App{
 		ID: "someApp",
 		HealthChecks: []apps.HealthCheck{
@@ -780,7 +780,7 @@ func TestMarathonTaskToConsulServiceMapping_NotResolvableTaskHost(t *testing.T)
 	t.Parallel()
 
 	// given
-	consul := New(ConsulConfig{Tag: "marathon"})
+	consul := New(Config{Tag: "marathon"})
 	app := &apps.App{
 		ID: "someApp",
 		HealthChecks: []apps.HealthCheck{
diff --git a/consul/consul_test_server.go b/consul/consul_test_server.go
index 3d2c73e..a59c5de 100644
--- a/consul/consul_test_server.go
+++ b/consul/consul_test_server.go
@@ -10,8 +10,24 @@ import (
 	"github.com/stretchr/testify/assert"
 )
 
+func CreateTestServer(t *testing.T) *testutil.TestServer {
+	ports, err := getPorts(6)
+	assert.NoError(t, err)
+	return testutil.NewTestServerConfig(t, func(c *testutil.TestServerConfig) {
+		c.Datacenter = fmt.Sprint("dc-", time.Now().UnixNano())
+		c.Ports = &testutil.TestPortConfig{
+			DNS:     ports[0],
+			HTTP:    ports[1],
+			RPC:     ports[2],
+			SerfLan: ports[3],
+			SerfWan: ports[4],
+			Server:  ports[5],
+		}
+	})
+}
+
 // Ask the kernel for free open ports that are ready to use
-func GetPorts(number int) ([]int, error) {
+func getPorts(number int) ([]int, error) {
 	ports := make([]int, number)
 	listener := make([]*net.TCPListener, number)
 	defer func() {
@@ -35,32 +51,16 @@ func GetPorts(number int) ([]int, error) {
 	return ports, nil
 }
 
-func CreateConsulTestServer(t *testing.T) *testutil.TestServer {
-	ports, err := GetPorts(6)
-	assert.NoError(t, err)
-	return testutil.NewTestServerConfig(t, func(c *testutil.TestServerConfig) {
-		c.Datacenter = fmt.Sprint("dc-", time.Now().UnixNano())
-		c.Ports = &testutil.TestPortConfig{
-			DNS:     ports[0],
-			HTTP:    ports[1],
-			RPC:     ports[2],
-			SerfLan: ports[3],
-			SerfWan: ports[4],
-			Server:  ports[5],
-		}
-	})
-}
-
-func ConsulClientAtServer(server *testutil.TestServer) *Consul {
+func ClientAtServer(server *testutil.TestServer) *Consul {
 	return consulClientAtAddress(server.Config.Bind, server.Config.Ports.HTTP)
 }
 
-func FailingConsulClient() *Consul {
+func FailingClient() *Consul {
 	return consulClientAtAddress("127.5.5.5", 5555)
 }
 
 func consulClientAtAddress(host string, port int) *Consul {
-	config := ConsulConfig{
+	config := Config{
 		Timeout:             10 * time.Millisecond,
 		Port:                fmt.Sprintf("%d", port),
 		ConsulNameSeparator: ".",
diff --git a/events/deployment_info_test.go b/events/deployment_info_test.go
index e858267..e6f7905 100644
--- a/events/deployment_info_test.go
+++ b/events/deployment_info_test.go
@@ -21,7 +21,7 @@ func TestParseDeploymentInfo(t *testing.T) {
 	// then
 	assert.NoError(t, err)
 	assert.Equal(t, "StopApplication", action.Type)
-	assert.Equal(t, "/internalName", action.AppId.String())
+	assert.Equal(t, "/internalName", action.AppID.String())
 	assert.Equal(t, "/internalName", app.ID.String())
 	assert.Equal(t, "consulName", app.Labels["consul"])
 }
@@ -39,7 +39,7 @@ func TestParseDeploymentStepSuccess(t *testing.T) {
 	// then
 	assert.NoError(t, err)
 	assert.Equal(t, "RestartApplication", action.Type)
-	assert.Equal(t, "/a", action.AppId.String())
+	assert.Equal(t, "/a", action.AppID.String())
 	assert.Equal(t, "/a", app.ID.String())
 	assert.Equal(t, "b", app.Labels["consul"])
 }
@@ -57,7 +57,7 @@ func TestParseDeploymentStepSuccessWithGroups(t *testing.T) {
 	// then
 	assert.NoError(t, err)
 	assert.Equal(t, "RestartApplication", action.Type)
-	assert.Equal(t, "/com.example/things/something", action.AppId.String())
+	assert.Equal(t, "/com.example/things/something", action.AppID.String())
 	assert.Equal(t, "/com.example/things/something", app.ID.String())
 	assert.Equal(t, "something", app.Labels["consul"])
 }
@@ -114,10 +114,10 @@ func TestStoppedConsulApps(t *testing.T) {
 		},
 		CurrentStep: &CurrentStep{
 			Actions: []*Action{
-				{Type: "StartApplication", AppId: "app1"},
-				{Type: "StopApplication", AppId: "app2"},
-				{Type: "StopApplication", AppId: "app3"},
-				{Type: "StopApplication", AppId: "app4"},
+				{Type: "StartApplication", AppID: "app1"},
+				{Type: "StopApplication", AppID: "app2"},
+				{Type: "StopApplication", AppID: "app3"},
+				{Type: "StopApplication", AppID: "app4"},
 			},
 		},
 	}
@@ -147,10 +147,10 @@ func TestRestartedConsulApps(t *testing.T) {
 		},
 		CurrentStep: &CurrentStep{
 			Actions: []*Action{
-				{Type: "StartApplication", AppId: "app1"},
-				{Type: "RestartApplication", AppId: "app2"},
-				{Type: "RestartApplication", AppId: "app3"},
-				{Type: "RestartApplication", AppId: "app4"},
+				{Type: "StartApplication", AppID: "app1"},
+				{Type: "RestartApplication", AppID: "app2"},
+				{Type: "RestartApplication", AppID: "app3"},
+				{Type: "RestartApplication", AppID: "app4"},
 			},
 		},
 	}
@@ -177,7 +177,7 @@ func TestStoppedConsulApps_NoStoppedApps(t *testing.T) {
 		},
 		CurrentStep: &CurrentStep{
 			Actions: []*Action{
-				{Type: "StartApplication", AppId: "app1"},
+				{Type: "StartApplication", AppID: "app1"},
 			},
 		},
 	}
@@ -223,9 +223,9 @@ func TestRenamedConsulApps(t *testing.T) {
 		},
 		CurrentStep: &CurrentStep{
 			Actions: []*Action{
-				{Type: "RestartApplication", AppId: "app1"},
-				{Type: "StartApplication", AppId: "app2"},
-				{Type: "RestartApplication", AppId: "app3"},
+				{Type: "RestartApplication", AppID: "app1"},
+				{Type: "StartApplication", AppID: "app2"},
+				{Type: "RestartApplication", AppID: "app3"},
 			},
 		},
 	}
@@ -244,9 +244,9 @@ func TestRenamedConsulApps_OnEmptyPlan(t *testing.T) {
 	deploymentInfo := &DeploymentEvent{
 		CurrentStep: &CurrentStep{
 			Actions: []*Action{
-				{Type: "RestartApplication", AppId: "app2"},
-				{Type: "StartApplication", AppId: "app1"},
-				{Type: "RestartApplication", AppId: "app3"},
+				{Type: "RestartApplication", AppID: "app2"},
+				{Type: "StartApplication", AppID: "app1"},
+				{Type: "RestartApplication", AppID: "app3"},
 			},
 		},
 	}
@@ -278,8 +278,8 @@ func TestRenamedConsulApps_OnConsulTrueCase(t *testing.T) {
 		},
 		CurrentStep: &CurrentStep{
 			Actions: []*Action{
-				{Type: "RestartApplication", AppId: "app1"},
-				{Type: "RestartApplication", AppId: "app2"},
+				{Type: "RestartApplication", AppID: "app1"},
+				{Type: "RestartApplication", AppID: "app2"},
 			},
 		},
 	}
@@ -311,8 +311,8 @@ func TestRenamedConsulApps_OnCustomNameAdded(t *testing.T) {
 		},
 		CurrentStep: &CurrentStep{
 			Actions: []*Action{
-				{Type: "RestartApplication", AppId: "app1"},
-				{Type: "StartApplication", AppId: "app2"},
+				{Type: "RestartApplication", AppID: "app1"},
+				{Type: "StartApplication", AppID: "app2"},
 			},
 		},
 	}
@@ -345,8 +345,8 @@ func TestRenamedConsulApps_OnCustomNameAddedToNonConsulApp(t *testing.T) {
 		},
 		CurrentStep: &CurrentStep{
 			Actions: []*Action{
-				{Type: "RestartApplication", AppId: "app1"},
-				{Type: "StartApplication", AppId: "app2"},
+				{Type: "RestartApplication", AppID: "app1"},
+				{Type: "StartApplication", AppID: "app2"},
 			},
 		},
 	}
@@ -378,8 +378,8 @@ func TestRenamedConsulApps_OnConsulLabelRemoved(t *testing.T) {
 		},
 		CurrentStep: &CurrentStep{
 			Actions: []*Action{
-				{Type: "RestartApplication", AppId: "app1"},
-				{Type: "StartApplication", AppId: "app2"},
+				{Type: "RestartApplication", AppID: "app1"},
+				{Type: "StartApplication", AppID: "app2"},
 			},
 		},
 	}
diff --git a/scripts/migrate_to_marathon_task_tag/main_test.go b/scripts/migrate_to_marathon_task_tag/main_test.go
index 3071d7d..1c3311f 100644
--- a/scripts/migrate_to_marathon_task_tag/main_test.go
+++ b/scripts/migrate_to_marathon_task_tag/main_test.go
@@ -15,7 +15,7 @@ import (
 func TestMigrateToMarathonTaskTag_shouldMigrateOnlyServicesWithMarathonTagAndWithoutTaskTag(t *testing.T) {
 	t.Parallel()
 	// given
-	server := consul.CreateConsulTestServer(t)
+	server := consul.CreateTestServer(t)
 	defer server.Stop()
 	server.AddService("serviceA", "passing", []string{"marathon"})
 	server.AddService("serviceB-critical", "critical", []string{"marathon"})
@@ -40,7 +40,7 @@ func TestMigrateToMarathonTaskTag_shouldMigrateOnlyServicesWithMarathonTagAndWit
 func TestMigrateToMarathonTaskTag_shouldLeaveServicePropertiesOtherThanTagsUnchanged(t *testing.T) {
 	t.Parallel()
 	// given
-	server := consul.CreateConsulTestServer(t)
+	server := consul.CreateTestServer(t)
 	defer server.Stop()
 	client, _ := clientToServer(server)
 	client.Agent().ServiceRegister(&api.AgentServiceRegistration{
@@ -81,9 +81,9 @@ func TestMigrateToMarathonTaskTag_shouldLeaveServicePropertiesOtherThanTagsUncha
 func TestMigrateToMarathonTaskTag_shouldMigrateServicesInBootstrapAgentsDCOnly(t *testing.T) {
 	t.Parallel()
 	// given
-	server := consul.CreateConsulTestServer(t)
+	server := consul.CreateTestServer(t)
 	defer server.Stop()
-	serverOnOtherDC := consul.CreateConsulTestServer(t)
+	serverOnOtherDC := consul.CreateTestServer(t)
 	defer serverOnOtherDC.Stop()
 	server.JoinWAN(serverOnOtherDC.WANAddr)
 
@@ -105,7 +105,7 @@ func TestMigrateToMarathonTaskTag_shouldMigrateServicesInBootstrapAgentsDCOnly(t
 func TestMigrateToMarathonTaskTag_shouldMigrateThroughCallingMain(t *testing.T) {
 	t.Parallel()
 	// given
-	server := consul.CreateConsulTestServer(t)
+	server := consul.CreateTestServer(t)
 	defer server.Stop()
 	server.AddService("serviceA", "passing", []string{"marathon"})
 	os.Args = []string{"./migrate", fmt.Sprintf("--bootstrap-agent-location=%s", server.HTTPAddr)}
diff --git a/service/service_test.go b/service/service_test.go
index 821079b..4e1310e 100644
--- a/service/service_test.go
+++ b/service/service_test.go
@@ -9,7 +9,7 @@ import (
 
 func TestMarathonTaskTAg(t *testing.T) {
 	t.Parallel()
-	assert.Equal(t, "marathon-task:my-task", MarathonTaskTag(apps.TaskId("my-task")))
+	assert.Equal(t, "marathon-task:my-task", MarathonTaskTag(apps.TaskID("my-task")))
 }
 
 func TestServiceTaskId(t *testing.T) {
@@ -18,15 +18,15 @@ func TestServiceTaskId(t *testing.T) {
 	service := Service{
 		ID:   "123",
 		Name: "abc",
-		RegisteringAgentAddress: "localhost",
 		Tags: []string{MarathonTaskTag("my-task")},
+		RegisteringAgentAddress: "localhost",
 	}
 
 	// when
 	id, err := service.TaskId()
 
 	// then
-	assert.Equal(t, apps.TaskId("my-task"), id)
+	assert.Equal(t, apps.TaskID("my-task"), id)
 	assert.NoError(t, err)
 }
 
@@ -36,8 +36,8 @@ func TestServiceTaskId_NoMarathonTaskTag(t *testing.T) {
 	service := Service{
 		ID:   "123",
 		Name: "abc",
-		RegisteringAgentAddress: "localhost",
 		Tags: []string{},
+		RegisteringAgentAddress: "localhost",
 	}
 
 	// when
diff --git a/sync/error_marathon_stub_test.go b/sync/error_marathon_stub_test.go
index 8705db0..0734223 100644
--- a/sync/error_marathon_stub_test.go
+++ b/sync/error_marathon_stub_test.go
@@ -1,7 +1,7 @@
 package sync
 
 import (
-	"fmt"
+	"errors"
 
 	"github.com/allegro/marathon-consul/apps"
 )
@@ -10,17 +10,17 @@ type errorMarathon struct {
 }
 
 func (m errorMarathon) ConsulApps() ([]*apps.App, error) {
-	return nil, fmt.Errorf("Error")
+	return nil, errors.New("Error")
 }
 
-func (m errorMarathon) App(id apps.AppId) (*apps.App, error) {
-	return nil, fmt.Errorf("Error")
+func (m errorMarathon) App(id apps.AppID) (*apps.App, error) {
+	return nil, errors.New("Error")
 }
 
-func (m errorMarathon) Tasks(appId apps.AppId) ([]*apps.Task, error) {
-	return nil, fmt.Errorf("Error")
+func (m errorMarathon) Tasks(appID apps.AppID) ([]*apps.Task, error) {
+	return nil, errors.New("Error")
 }
 
 func (m errorMarathon) Leader() (string, error) {
-	return "", fmt.Errorf("Error")
+	return "", errors.New("Error")
 }
diff --git a/sync/error_service_registry_stub_test.go b/sync/error_service_registry_stub_test.go
index 174a471..44a505d 100644
--- a/sync/error_service_registry_stub_test.go
+++ b/sync/error_service_registry_stub_test.go
@@ -1,8 +1,8 @@
 package sync
 
-import "fmt"
-
 import (
+	"errors"
+
 	"github.com/allegro/marathon-consul/apps"
 	"github.com/allegro/marathon-consul/service"
 )
@@ -11,23 +11,23 @@ type errorServiceRegistry struct {
 }
 
 func (c errorServiceRegistry) GetServices(name string) ([]*service.Service, error) {
-	return nil, fmt.Errorf("Error occured")
+	return nil, errors.New("Error occured")
 }
 
 func (c errorServiceRegistry) GetAllServices() ([]*service.Service, error) {
-	return nil, fmt.Errorf("Error occured")
+	return nil, errors.New("Error occured")
 }
 
 func (c errorServiceRegistry) Register(task *apps.Task, app *apps.App) error {
-	return fmt.Errorf("Error occured")
+	return errors.New("Error occured")
 }
 
-func (c errorServiceRegistry) DeregisterByTask(taskId apps.TaskId) error {
-	return fmt.Errorf("Error occured")
+func (c errorServiceRegistry) DeregisterByTask(taskID apps.TaskID) error {
+	return errors.New("Error occured")
 }
 
 func (c errorServiceRegistry) Deregister(toDeregister *service.Service) error {
-	return fmt.Errorf("Error occured")
+	return errors.New("Error occured")
 }
 
 func (c errorServiceRegistry) ServiceNames(app *apps.App) []string {
diff --git a/sync/sync_test.go b/sync/sync_test.go
index 56bd41b..432ce05 100644
--- a/sync/sync_test.go
+++ b/sync/sync_test.go
@@ -16,6 +16,8 @@ import (
 	"github.com/allegro/marathon-consul/service"
 )
 
+var noopSyncStartedListener = func(apps []*apps.App) {}
+
 func TestSyncJob_ShouldSyncOnLeadership(t *testing.T) {
 	t.Parallel()
 	// given
@@ -32,11 +34,9 @@ func TestSyncJob_ShouldSyncOnLeadership(t *testing.T) {
 	ticker := sync.StartSyncServicesJob()
 
 	// then
-	select {
-	case <-time.After(15 * time.Millisecond):
-		ticker.Stop()
-		assert.Equal(t, 2, services.RegistrationsCount(app.Tasks[0].ID.String()))
-	}
+	<-time.After(15 * time.Millisecond)
+	ticker.Stop()
+	assert.Equal(t, 2, services.RegistrationsCount(app.Tasks[0].ID.String()))
 }
 
 func TestSyncJob_ShouldNotSyncWhenDisabled(t *testing.T) {
@@ -56,10 +56,8 @@ func TestSyncJob_ShouldNotSyncWhenDisabled(t *testing.T) {
 
 	// then
 	assert.Nil(t, ticker)
-	select {
-	case <-time.After(15 * time.Millisecond):
-		assert.Equal(t, 0, services.RegistrationsCount(app.Tasks[0].ID.String()))
-	}
+	<-time.After(15 * time.Millisecond)
+	assert.Equal(t, 0, services.RegistrationsCount(app.Tasks[0].ID.String()))
 }
 
 func TestSyncJob_ShouldDefaultLeaderConfigurationToResolvedHostname(t *testing.T) {
@@ -78,11 +76,9 @@ func TestSyncJob_ShouldDefaultLeaderConfigurationToResolvedHostname(t *testing.T
 	ticker := sync.StartSyncServicesJob()
 
 	// then
-	select {
-	case <-time.After(15 * time.Millisecond):
-		ticker.Stop()
-		assert.Equal(t, 2, services.RegistrationsCount(app.Tasks[0].ID.String()))
-	}
+	<-time.After(15 * time.Millisecond)
+	ticker.Stop()
+	assert.Equal(t, 2, services.RegistrationsCount(app.Tasks[0].ID.String()))
 }
 
 func TestSyncServices_ShouldNotSyncOnNoForceNorLeaderSpecified(t *testing.T) {
@@ -156,11 +152,11 @@ func (c *ConsulServicesMock) Register(task *apps.Task, app *apps.App) error {
 	return nil
 }
 
-func (c *ConsulServicesMock) RegistrationsCount(instanceId string) int {
-	return c.registrations[instanceId]
+func (c *ConsulServicesMock) RegistrationsCount(instanceID string) int {
+	return c.registrations[instanceID]
 }
 
-func (c *ConsulServicesMock) DeregisterByTask(taskId apps.TaskId) error {
+func (c *ConsulServicesMock) DeregisterByTask(taskID apps.TaskID) error {
 	return nil
 }
 
@@ -316,7 +312,7 @@ func TestSync_WithRegisteringProblems(t *testing.T) {
 	// given
 	marathon := marathon.MarathonerStubForApps(ConsulApp("/test/app", 3))
 	consul := consul.NewConsulStub()
-	consul.FailRegisterForId("test_app.1")
+	consul.FailRegisterForID("test_app.1")
 	sync := newSyncWithDefaultConfig(marathon, consul)
 	// when
 	err := sync.SyncServices()
@@ -359,7 +355,7 @@ func TestSync_WithDeregisteringProblems(t *testing.T) {
 	}
 	allServices, _ := consulStub.GetAllServices()
 	for _, s := range allServices {
-		consulStub.FailDeregisterForId(s.ID)
+		consulStub.FailDeregisterForID(s.ID)
 	}
 
 	sync := newSyncWithDefaultConfig(marathon, consulStub)
@@ -401,10 +397,10 @@ func newSyncWithDefaultConfig(marathon marathon.Marathoner, serviceRegistry serv
 func TestSync_AddingAgentsFromMarathonTasks(t *testing.T) {
 	t.Parallel()
 
-	consulServer := consul.CreateConsulTestServer(t)
+	consulServer := consul.CreateTestServer(t)
 	defer consulServer.Stop()
 
-	consulInstance := consul.New(consul.ConsulConfig{
+	consulInstance := consul.New(consul.Config{
 		Port: fmt.Sprintf("%d", consulServer.Config.Ports.HTTP),
 		Tag:  "marathon",
 	})
diff --git a/web/event_handler_test.go b/web/event_handler_test.go
index 8e9ab9a..d48a3bb 100644
--- a/web/event_handler_test.go
+++ b/web/event_handler_test.go
@@ -3,6 +3,7 @@ package web
 import (
 	"bytes"
 	"encoding/json"
+	"errors"
 	"fmt"
 	"net/http"
 	"net/http/httptest"
@@ -141,7 +142,7 @@ func TestWebHandler_HandleDeploymentInfoWithStopApplicationAction(t *testing.T)
 	app := ConsulApp("/test/app", 3)
 	marathon := marathon.MarathonerStubForApps()
 	service := newConsulStubWithApplicationsTasksRegistered(app)
-	assert.Len(t, service.RegisteredTaskIds(), 3)
+	assert.Len(t, service.RegisteredTaskIDs(), 3)
 	handle, stop := NewHandler(Config{WorkersCount: 1}, marathon, service)
 	app.Tasks = []apps.Task{} // tasks are not available in this event
 	body, _ := json.Marshal(deploymentInfoWithStopApplicationActionForApps(app))
@@ -154,7 +155,7 @@ func TestWebHandler_HandleDeploymentInfoWithStopApplicationAction(t *testing.T)
 
 	// then
 	assertAccepted(t, recorder)
-	assert.Empty(t, service.RegisteredTaskIds())
+	assert.Empty(t, service.RegisteredTaskIDs())
 	assert.False(t, marathon.Interactions())
 }
 
@@ -163,12 +164,12 @@ func TestWebHandler_handleDeploymentInfoWithStopApplicationForOneApp(t *testing.
 
 	// given
 	green := ConsulApp("/test/app.green", 3)
-	green.Labels[apps.MARATHON_CONSUL_LABEL] = "app"
+	green.Labels[apps.MarathonConsulLabel] = "app"
 	blue := ConsulApp("/test/app.blue", 2)
-	blue.Labels[apps.MARATHON_CONSUL_LABEL] = "app"
+	blue.Labels[apps.MarathonConsulLabel] = "app"
 	marathon := marathon.MarathonerStubForApps()
 	service := newConsulStubWithApplicationsTasksRegistered(green, blue)
-	assert.Len(t, service.RegisteredTaskIds(), 5)
+	assert.Len(t, service.RegisteredTaskIDs(), 5)
 	handle, stop := NewHandler(Config{WorkersCount: 1}, marathon, service)
 	body, _ := json.Marshal(deploymentInfoWithStopApplicationActionForApps(green))
 	req, _ := http.NewRequest("POST", "/events", bytes.NewBuffer([]byte(body)))
@@ -180,7 +181,7 @@ func TestWebHandler_handleDeploymentInfoWithStopApplicationForOneApp(t *testing.
 
 	// then
 	assertAccepted(t, recorder)
-	assert.Len(t, service.RegisteredTaskIds(), 2)
+	assert.Len(t, service.RegisteredTaskIDs(), 2)
 	assert.False(t, marathon.Interactions())
 }
 
@@ -192,7 +193,7 @@ func TestWebHandler_HandleDeploymentInfoWithStopApplicationActionForMultipleApps
 	app2 := ConsulApp("/test/otherapp", 2)
 	marathon := marathon.MarathonerStubForApps()
 	service := newConsulStubWithApplicationsTasksRegistered(app1, app2)
-	assert.Len(t, service.RegisteredTaskIds(), 5)
+	assert.Len(t, service.RegisteredTaskIDs(), 5)
 	handle, stop := NewHandler(Config{WorkersCount: 1}, marathon, service)
 	body, _ := json.Marshal(deploymentInfoWithStopApplicationActionForApps(app1, app2))
 	req, _ := http.NewRequest("POST", "/events", bytes.NewBuffer([]byte(body)))
@@ -204,7 +205,7 @@ func TestWebHandler_HandleDeploymentInfoWithStopApplicationActionForMultipleApps
 
 	// then
 	assertAccepted(t, recorder)
-	assert.Len(t, service.RegisteredTaskIds(), 0)
+	assert.Len(t, service.RegisteredTaskIDs(), 0)
 	assert.False(t, marathon.Interactions())
 }
 
@@ -216,8 +217,8 @@ func TestWebHandler_HandleDeploymentInfoWithStopApplicationActionForMultipleApps
 	app2 := ConsulApp("/test/otherapp", 2)
 	marathon := marathon.MarathonerStubForApps()
 	service := newConsulStubWithApplicationsTasksRegistered(app1, app2)
-	service.FailDeregisterByTaskForId("test_app.1")
-	assert.Len(t, service.RegisteredTaskIds(), 5)
+	service.FailDeregisterByTaskForID("test_app.1")
+	assert.Len(t, service.RegisteredTaskIDs(), 5)
 	handle, stop := NewHandler(Config{WorkersCount: 1}, marathon, service)
 	body, _ := json.Marshal(deploymentInfoWithStopApplicationActionForApps(app1, app2))
 	req, _ := http.NewRequest("POST", "/events", bytes.NewBuffer([]byte(body)))
@@ -229,7 +230,7 @@ func TestWebHandler_HandleDeploymentInfoWithStopApplicationActionForMultipleApps
 
 	// then
 	assertAccepted(t, recorder)
-	assert.Len(t, service.RegisteredTaskIds(), 1)
+	assert.Len(t, service.RegisteredTaskIDs(), 1)
 	assert.False(t, marathon.Interactions())
 }
 
@@ -240,7 +241,7 @@ func TestWebHandler_HandleDeploymentInfoWithStopApplicationActionWithNoServicesR
 	app := ConsulApp("/test/app", 3)
 	marathon := marathon.MarathonerStubForApps()
 	service := consul.NewConsulStub()
-	assert.Len(t, service.RegisteredTaskIds(), 0)
+	assert.Len(t, service.RegisteredTaskIDs(), 0)
 	handle, stop := NewHandler(Config{WorkersCount: 1}, marathon, service)
 	body, _ := json.Marshal(deploymentInfoWithStopApplicationActionForApps(app))
 	req, _ := http.NewRequest("POST", "/events", bytes.NewBuffer([]byte(body)))
@@ -252,7 +253,7 @@ func TestWebHandler_HandleDeploymentInfoWithStopApplicationActionWithNoServicesR
 
 	// then
 	assertAccepted(t, recorder)
-	assert.Len(t, service.RegisteredTaskIds(), 0)
+	assert.Len(t, service.RegisteredTaskIDs(), 0)
 	assert.False(t, marathon.Interactions())
 }
 
@@ -263,7 +264,7 @@ func TestWebHandler_HandleDeploymentInfoWithInvalidBody(t *testing.T) {
 	app := ConsulApp("/test/app", 3)
 	marathon := marathon.MarathonerStubForApps()
 	service := newConsulStubWithApplicationsTasksRegistered(app)
-	assert.Len(t, service.RegisteredTaskIds(), 3)
+	assert.Len(t, service.RegisteredTaskIDs(), 3)
 	handle, stop := NewHandler(Config{WorkersCount: 1}, marathon, service)
 	req, _ := http.NewRequest("POST", "/events", bytes.NewBuffer([]byte(`{"eventType":"deployment_info", "Plan": 123}`)))
 
@@ -274,7 +275,7 @@ func TestWebHandler_HandleDeploymentInfoWithInvalidBody(t *testing.T) {
 
 	// then
 	assertAccepted(t, recorder)
-	assert.Len(t, service.RegisteredTaskIds(), 3)
+	assert.Len(t, service.RegisteredTaskIDs(), 3)
 	assert.False(t, marathon.Interactions())
 }
 
@@ -285,7 +286,7 @@ func TestWebHandler_HandleDeploymentInfoWithStopApplicationActionForNonConsulApp
 	app := NonConsulApp("/test/app", 3)
 	marathon := marathon.MarathonerStubForApps()
 	service := newConsulStubWithApplicationsTasksRegistered(app)
-	assert.Len(t, service.RegisteredTaskIds(), 3)
+	assert.Len(t, service.RegisteredTaskIDs(), 3)
 	handle, stop := NewHandler(Config{WorkersCount: 1}, marathon, service)
 	body, _ := json.Marshal(deploymentInfoWithStopApplicationActionForApps(app))
 	req, _ := http.NewRequest("POST", "/events", bytes.NewBuffer([]byte(body)))
@@ -297,7 +298,7 @@ func TestWebHandler_HandleDeploymentInfoWithStopApplicationActionForNonConsulApp
 
 	// then
 	assertAccepted(t, recorder)
-	assert.Len(t, service.RegisteredTaskIds(), 3)
+	assert.Len(t, service.RegisteredTaskIDs(), 3)
 	assert.False(t, marathon.Interactions())
 }
 
@@ -309,7 +310,7 @@ func TestWebHandler_HandleDeploymentInfoWithStopApplicationActionForCustomServic
 	app.Labels["consul"] = "someCustomServiceName"
 	marathon := marathon.MarathonerStubForApps()
 	service := newConsulStubWithApplicationsTasksRegistered(app)
-	assert.Len(t, service.RegisteredTaskIds(), 3)
+	assert.Len(t, service.RegisteredTaskIDs(), 3)
 	handle, stop := NewHandler(Config{WorkersCount: 1}, marathon, service)
 	body, _ := json.Marshal(deploymentInfoWithStopApplicationActionForApps(app))
 	req, _ := http.NewRequest("POST", "/events", bytes.NewBuffer([]byte(body)))
@@ -321,7 +322,7 @@ func TestWebHandler_HandleDeploymentInfoWithStopApplicationActionForCustomServic
 
 	// then
 	assertAccepted(t, recorder)
-	assert.Len(t, service.RegisteredTaskIds(), 0)
+	assert.Len(t, service.RegisteredTaskIDs(), 0)
 	assert.False(t, marathon.Interactions())
 }
 
@@ -332,7 +333,7 @@ func TestWebHandler_NotHandleDeploymentInfoWithScaleApplicationAction(t *testing
 	app := ConsulApp("/test/app", 3)
 	marathon := marathon.MarathonerStubForApps()
 	service := newConsulStubWithApplicationsTasksRegistered(app)
-	assert.Len(t, service.RegisteredTaskIds(), 3)
+	assert.Len(t, service.RegisteredTaskIDs(), 3)
 	handle, stop := NewHandler(Config{WorkersCount: 1}, marathon, service)
 	deploymentInfo := deploymentInfoWithStopApplicationActionForApps(app)
 	deploymentInfo.CurrentStep.Actions[0].Type = "ScaleApplication"
@@ -346,7 +347,7 @@ func TestWebHandler_NotHandleDeploymentInfoWithScaleApplicationAction(t *testing
 
 	// then
 	assertAccepted(t, recorder)
-	assert.Len(t, service.RegisteredTaskIds(), 3)
+	assert.Len(t, service.RegisteredTaskIDs(), 3)
 	assert.False(t, marathon.Interactions())
 }
 
@@ -357,8 +358,8 @@ func TestWebHandler_HandleDeploymentInfoWithStopApplicationActionAndProblemsDere
 	app := ConsulApp("/test/app", 3)
 	marathon := marathon.MarathonerStubForApps()
 	service := newConsulStubWithApplicationsTasksRegistered(app)
-	service.FailDeregisterByTaskForId("test_app.1")
-	assert.Len(t, service.RegisteredTaskIds(), 3)
+	service.FailDeregisterByTaskForID("test_app.1")
+	assert.Len(t, service.RegisteredTaskIDs(), 3)
 	handle, stop := NewHandler(Config{WorkersCount: 1}, marathon, service)
 	body, _ := json.Marshal(deploymentInfoWithStopApplicationActionForApps(app))
 	req, _ := http.NewRequest("POST", "/events", bytes.NewBuffer([]byte(body)))
@@ -370,7 +371,7 @@ func TestWebHandler_HandleDeploymentInfoWithStopApplicationActionAndProblemsDere
 
 	// then
 	assertAccepted(t, recorder)
-	assert.Len(t, service.RegisteredTaskIds(), 1)
+	assert.Len(t, service.RegisteredTaskIDs(), 1)
 	assert.False(t, marathon.Interactions())
 }
 
@@ -389,7 +390,7 @@ func deploymentInfoWithStopApplicationActionForApps(applications ...*apps.App) *
 	}
 	for _, app := range applications {
 		deploymentInfo.Plan.Original.Apps = append(deploymentInfo.Plan.Original.Apps, app)
-		deploymentInfo.CurrentStep.Actions = append(deploymentInfo.CurrentStep.Actions, &events.Action{AppId: app.ID, Type: "StopApplication"})
+		deploymentInfo.CurrentStep.Actions = append(deploymentInfo.CurrentStep.Actions, &events.Action{AppID: app.ID, Type: "StopApplication"})
 	}
 	return deploymentInfo
 }
@@ -401,7 +402,7 @@ func TestWebHandler_HandleDeploymentStepSuccessWithRestartAndRenameApplicationAc
 	app := ConsulApp("/test/app", 3)
 	marathon := marathon.MarathonerStubForApps()
 	service := newConsulStubWithApplicationsTasksRegistered(app)
-	assert.Len(t, service.RegisteredTaskIds(), 3)
+	assert.Len(t, service.RegisteredTaskIDs(), 3)
 	handle, stop := NewHandler(Config{WorkersCount: 1}, marathon, service)
 	body, _ := json.Marshal(deploymentStepSuccessWithRestartAndRenameApplicationActionForApps(app))
 	req, _ := http.NewRequest("POST", "/events", bytes.NewBuffer([]byte(body)))
@@ -413,7 +414,7 @@ func TestWebHandler_HandleDeploymentStepSuccessWithRestartAndRenameApplicationAc
 
 	// then
 	assertAccepted(t, recorder)
-	assert.Len(t, service.RegisteredTaskIds(), 0)
+	assert.Len(t, service.RegisteredTaskIDs(), 0)
 	assert.False(t, marathon.Interactions())
 }
 
@@ -424,7 +425,7 @@ func TestWebHandler_HandleDeploymentStepSuccessWithInvalidBody(t *testing.T) {
 	app := ConsulApp("/test/app", 3)
 	marathon := marathon.MarathonerStubForApps()
 	service := newConsulStubWithApplicationsTasksRegistered(app)
-	assert.Len(t, service.RegisteredTaskIds(), 3)
+	assert.Len(t, service.RegisteredTaskIDs(), 3)
 	handle, stop := NewHandler(Config{WorkersCount: 1}, marathon, service)
 	req, _ := http.NewRequest("POST", "/events", bytes.NewBuffer([]byte(`{"eventType":"deployment_step_success", "Plan": 123}`)))
 
@@ -435,7 +436,7 @@ func TestWebHandler_HandleDeploymentStepSuccessWithInvalidBody(t *testing.T) {
 
 	// then
 	assertAccepted(t, recorder)
-	assert.Len(t, service.RegisteredTaskIds(), 3)
+	assert.Len(t, service.RegisteredTaskIDs(), 3)
 	assert.False(t, marathon.Interactions())
 }
 
@@ -447,8 +448,8 @@ func TestWebHandler_HandleDeploymentStepSuccessWithRestartApplicationActionForMu
 	app2 := ConsulApp("/test/otherapp", 2)
 	marathon := marathon.MarathonerStubForApps()
 	service := newConsulStubWithApplicationsTasksRegistered(app1, app2)
-	service.FailDeregisterByTaskForId("test_app.1")
-	assert.Len(t, service.RegisteredTaskIds(), 5)
+	service.FailDeregisterByTaskForID("test_app.1")
+	assert.Len(t, service.RegisteredTaskIDs(), 5)
 	handle, stop := NewHandler(Config{WorkersCount: 1}, marathon, service)
 	body, _ := json.Marshal(deploymentStepSuccessWithRestartAndRenameApplicationActionForApps(app1, app2))
 	req, _ := http.NewRequest("POST", "/events", bytes.NewBuffer([]byte(body)))
@@ -460,7 +461,7 @@ func TestWebHandler_HandleDeploymentStepSuccessWithRestartApplicationActionForMu
 
 	// then
 	assertAccepted(t, recorder)
-	assert.Len(t, service.RegisteredTaskIds(), 1)
+	assert.Len(t, service.RegisteredTaskIDs(), 1)
 	assert.False(t, marathon.Interactions())
 }
 
@@ -486,7 +487,7 @@ func deploymentStepSuccessWithRestartAndRenameApplicationActionForApps(applicati
 			targetApp.Labels["consul"] = fmt.Sprintf("New%s", name)
 		}
 		deploymentInfo.Plan.Target.Apps = append(deploymentInfo.Plan.Target.Apps, targetApp)
-		deploymentInfo.CurrentStep.Actions = append(deploymentInfo.CurrentStep.Actions, &events.Action{AppId: app.ID, Type: "RestartApplication"})
+		deploymentInfo.CurrentStep.Actions = append(deploymentInfo.CurrentStep.Actions, &events.Action{AppID: app.ID, Type: "RestartApplication"})
 	}
 	return deploymentInfo
 }
@@ -555,7 +556,7 @@ func TestWebHandler_NotHandleStatusEventAboutStartingTask(t *testing.T) {
 		// then
 		assert.Equal(t, 202, recorder.Code)
 		assert.Equal(t, "OK\n", recorder.Body.String())
-		assert.Empty(t, services.RegisteredTaskIds())
+		assert.Empty(t, services.RegisteredTaskIDs())
 	}
 }
 
@@ -592,7 +593,7 @@ func TestWebHandler_HandleStatusEventAboutDeadTask(t *testing.T) {
 		recorder := httptest.NewRecorder()
 		handler.Handle(recorder, req)
 		stopChan <- stopEvent{}
-		taskIds := service.RegisteredTaskIds()
+		taskIds := service.RegisteredTaskIDs()
 
 		// then
 		assert.Equal(t, 202, recorder.Code)
@@ -631,7 +632,7 @@ func TestWebHandler_HandleEventAboutUnhealthyKilledTask(t *testing.T) {
 	recorder := httptest.NewRecorder()
 	handler.Handle(recorder, req)
 	stopChan <- stopEvent{}
-	taskIds := service.RegisteredTaskIds()
+	taskIds := service.RegisteredTaskIDs()
 
 	// then
 	assert.Equal(t, 202, recorder.Code)
@@ -676,7 +677,7 @@ func TestWebHandler_HandleStatusEventAboutDeadTaskErrOnDeregistration(t *testing
 
 	// given
 	service := consul.NewConsulStub()
-	service.FailDeregisterByTaskForId("task.1")
+	service.FailDeregisterByTaskForID("task.1")
 	queue := make(chan event)
 	stopChan := newEventHandler(0, service, nil, queue).Start()
 	handler := newWebHandler(queue)
@@ -703,7 +704,7 @@ func TestWebHandler_HandleStatusEventAboutDeadTaskErrOnDeregistration(t *testing
 
 	// then
 	assertAccepted(t, recorder)
-	assert.Empty(t, service.RegisteredTaskIds())
+	assert.Empty(t, service.RegisteredTaskIDs())
 }
 
 func TestWebHandler_NotHandleStatusEventAboutNonConsulAppsDeadTask(t *testing.T) {
@@ -781,7 +782,7 @@ func TestWebHandler_HandleHealthStatusEvent(t *testing.T) {
 	recorder := httptest.NewRecorder()
 	handle(recorder, req)
 	stop()
-	taskIds := service.RegisteredTaskIds()
+	taskIds := service.RegisteredTaskIDs()
 
 	// then
 	assertAccepted(t, recorder)
@@ -797,7 +798,7 @@ func TestWebHandler_HandleHealthStatusEventWithErrorsOnRegistration(t *testing.T
 	app := ConsulApp("/test/app", 3)
 	marathon := marathon.MarathonerStubForApps(app)
 	service := consul.NewConsulStub()
-	service.FailRegisterForId(app.Tasks[1].ID)
+	service.FailRegisterForID(app.Tasks[1].ID)
 	handle, stop := NewHandler(Config{WorkersCount: 1}, marathon, service)
 	body := healthStatusChangeEventForTask("test_app.1")
 	req, _ := http.NewRequest("POST", "/events", bytes.NewBuffer([]byte(body)))
@@ -809,7 +810,7 @@ func TestWebHandler_HandleHealthStatusEventWithErrorsOnRegistration(t *testing.T
 
 	// then
 	assertAccepted(t, recorder)
-	assert.Empty(t, service.RegisteredTaskIds())
+	assert.Empty(t, service.RegisteredTaskIDs())
 	assert.True(t, marathon.Interactions())
 }
 
@@ -962,7 +963,7 @@ func TestWebHandler_HandleHealthStatusEventWhenTaskIsNotInMarathon(t *testing.T)
 	assert.True(t, marathon.Interactions())
 }
 
-func newConsulStubWithApplicationsTasksRegistered(applications ...*apps.App) *consul.ConsulStub {
+func newConsulStubWithApplicationsTasksRegistered(applications ...*apps.App) *consul.Stub {
 	service := consul.NewConsulStub()
 	for _, app := range applications {
 		for _, task := range app.Tasks {
@@ -975,13 +976,13 @@ func newConsulStubWithApplicationsTasksRegistered(applications ...*apps.App) *co
 type BadReader struct{}
 
 func (r BadReader) Read(p []byte) (n int, err error) {
-	return 0, fmt.Errorf("Some error")
+	return 0, errors.New("Some error")
 }
 
-func healthStatusChangeEventForTask(taskId string) string {
+func healthStatusChangeEventForTask(taskID string) string {
 	return `{
 	  "appId":"/test/app",
-	  "taskId":"` + taskId + `",
+	  "taskId":"` + taskID + `",
 	  "version":"2015-12-07T09:02:48.981Z",
 	  "alive":true,
 	  "eventType":"health_status_changed_event",