Skip to content

Commit

Permalink
go fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurie Clark-Michalek committed Nov 13, 2015
1 parent 2bcceac commit b581ecf
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 26 deletions.
4 changes: 2 additions & 2 deletions api/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
)

type ServiceAPI struct {
Config *conf.Configuration
Storage service.Storage
Config *conf.Configuration
Storage service.Storage
}

func (d *ServiceAPI) All(w http.ResponseWriter, r *http.Request) {
Expand Down
6 changes: 3 additions & 3 deletions api/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import (
"net/http"

"github.com/QubitProducts/bamboo/configuration"
"github.com/QubitProducts/bamboo/services/service"
"github.com/QubitProducts/bamboo/services/haproxy"
"github.com/QubitProducts/bamboo/services/service"
)

type StateAPI struct {
Config *configuration.Configuration
Storage service.Storage
Config *configuration.Configuration
Storage service.Storage
}

func (state *StateAPI) Get(w http.ResponseWriter, r *http.Request) {
Expand Down
6 changes: 3 additions & 3 deletions services/event_bus/event_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package event_bus
import (
"github.com/QubitProducts/bamboo/configuration"
"github.com/QubitProducts/bamboo/services/haproxy"
"github.com/QubitProducts/bamboo/services/template"
"github.com/QubitProducts/bamboo/services/service"
"github.com/QubitProducts/bamboo/services/template"
"io/ioutil"
"log"
"os"
Expand All @@ -29,8 +29,8 @@ type ServiceEvent struct {
}

type Handlers struct {
Conf *configuration.Configuration
Storage service.Storage
Conf *configuration.Configuration
Storage service.Storage
}

func (h *Handlers) MarathonEventHandler(event MarathonEvent) {
Expand Down
6 changes: 3 additions & 3 deletions services/service/representation.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ type V2ServiceRepr struct {
}

func MakeV2ServiceRepr(service Service) *V2ServiceRepr {
config := make(map[string]string, len(service.Config) + 1)
config := make(map[string]string, len(service.Config)+1)
for k, v := range service.Config {
config[k] = v
}
Expand All @@ -71,9 +71,9 @@ func MakeV2ServiceRepr(service Service) *V2ServiceRepr {

func NewV2ServiceRepr(appID string, config map[string]string) *V2ServiceRepr {
return &V2ServiceRepr{
ID: appID,
ID: appID,
Version: "2",
Config: config,
Config: config,
}
}

Expand Down
2 changes: 1 addition & 1 deletion services/service/representation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package service

import (
"fmt"
"testing"
"math/rand"
"reflect"
"testing"
"testing/quick"

. "github.com/QubitProducts/bamboo/Godeps/_workspace/src/github.com/smartystreets/goconvey/convey"
Expand Down
2 changes: 1 addition & 1 deletion services/service/service.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package service

type Service struct {
Id string `param:"id"`
Id string `param:"id"`
// Acl is present for backwards compatability, and should not be written to.
// Instead, write to the "Acl" key in Config
Acl string `param:"acl"`
Expand Down
6 changes: 3 additions & 3 deletions services/service/zookeeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ package service
import (
"github.com/QubitProducts/bamboo/Godeps/_workspace/src/github.com/samuel/go-zookeeper/zk"
conf "github.com/QubitProducts/bamboo/configuration"
"net/url"
"log"
"net/url"
)

type ZKStorage struct {
conn *zk.Conn
conf conf.Zookeeper
acl []zk.ACL
acl []zk.ACL
}

func NewZKStorage(conn *zk.Conn, conf conf.Zookeeper) (s *ZKStorage, err error) {
s = &ZKStorage{
conn: conn,
conf: conf,
acl: defaultACL(),
acl: defaultACL(),
}
err = s.ensurePathExists()
return s, err
Expand Down
16 changes: 6 additions & 10 deletions services/service/zookeeper_test.go
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
package service

import (
"testing"
. "github.com/QubitProducts/bamboo/Godeps/_workspace/src/github.com/smartystreets/goconvey/convey"
"testing"

"time"
"log"
"time"

"github.com/QubitProducts/bamboo/Godeps/_workspace/src/github.com/samuel/go-zookeeper/zk"
"github.com/QubitProducts/bamboo/configuration"
)

var zkTimeout = time.Second
var zkConf = configuration.Zookeeper{
Host: "localhost:2181",
Path: "/test-bamboo",
Host: "localhost:2181",
Path: "/test-bamboo",
ReportingDelay: 1,
}


func cleanZK(conn *zk.Conn) {
deleteRecursive(conn, zkConf.Path)
}
Expand All @@ -30,7 +29,7 @@ func deleteRecursive(conn *zk.Conn, path string) {
return
}
for _, child := range children {
deleteRecursive(conn, path + "/" + child)
deleteRecursive(conn, path+"/"+child)
}
err = conn.Delete(path, -1)
if err != nil {
Expand Down Expand Up @@ -167,7 +166,7 @@ func TestZKStorage(t *testing.T) {
testService := Service{
Id: "test",
Config: map[string]string{
"Acl": "foo",
"Acl": "foo",
"barst": "carst",
},
}
Expand Down Expand Up @@ -230,7 +229,6 @@ func TestZKStorage(t *testing.T) {
s, err := NewZKStorage(conn, zkConf)
So(err, ShouldBeNil)


Convey("when I delete the only service", func() {
cleanZK(conn)
loadToZK(conn, [][2]string{
Expand All @@ -241,7 +239,6 @@ func TestZKStorage(t *testing.T) {
err := s.Delete("test")
So(err, ShouldBeNil)


Convey("there should be zero entries", func() {
entries, err := s.All()
So(err, ShouldBeNil)
Expand All @@ -260,7 +257,6 @@ func TestZKStorage(t *testing.T) {
})
So(err, ShouldNotBeNil)


Convey("there should be zero entries", func() {
entries, err := s.All()
So(err, ShouldBeNil)
Expand Down

0 comments on commit b581ecf

Please sign in to comment.