Skip to content

Commit

Permalink
Fix golint
Browse files Browse the repository at this point in the history
recent additions to golint mean that a number of files cause the
build to start failing if they are edited (we only run against changed
files)

This fixes all the errors in the repo so things don't unexpectedly start
failing for people making PRs
  • Loading branch information
errm committed Nov 16, 2016
1 parent 422aacf commit b0efd68
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
3 changes: 2 additions & 1 deletion acme/acme.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,12 @@ func (a *ACME) CreateClusterConfig(leadership *cluster.Leadership, tlsConfig *tl
}

datastore, err := cluster.NewDataStore(
leadership.Pool.Ctx(),
staert.KvSource{
Store: leadership.Store,
Prefix: a.Storage,
},
leadership.Pool.Ctx(), &Account{},
&Account{},
listener)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion acme/localStore.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (t *localTransaction) Commit(object cluster.Object) error {
t.LocalStore.account = object.(*Account)
defer t.storageLock.Unlock()
if t.dirty {
return fmt.Errorf("Transaction already used. Please begin a new one.")
return fmt.Errorf("transaction already used, please begin a new one")
}

// write account to file
Expand Down
4 changes: 2 additions & 2 deletions cluster/datastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ type Datastore struct {
}

// NewDataStore creates a Datastore
func NewDataStore(kvSource staert.KvSource, ctx context.Context, object Object, listener Listener) (*Datastore, error) {
func NewDataStore(ctx context.Context, kvSource staert.KvSource, object Object, listener Listener) (*Datastore, error) {
datastore := Datastore{
kv: kvSource,
ctx: ctx,
Expand Down Expand Up @@ -230,7 +230,7 @@ func (s *datastoreTransaction) Commit(object Object) error {
s.localLock.Lock()
defer s.localLock.Unlock()
if s.dirty {
return fmt.Errorf("Transaction already used. Please begin a new one.")
return fmt.Errorf("transaction already used, please begin a new one")
}
s.Datastore.meta.object = object
err := s.Datastore.meta.Marshall()
Expand Down
4 changes: 2 additions & 2 deletions cluster/leadership.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (l *Leadership) Participate(pool *safe.Pool) {
defer log.Debugf("Node %s no more running for election", l.Cluster.Node)
backOff := backoff.NewExponentialBackOff()
operation := func() error {
return l.run(l.candidate, ctx)
return l.run(ctx, l.candidate)
}

notify := func(err error, time time.Duration) {
Expand All @@ -63,7 +63,7 @@ func (l *Leadership) Resign() {
log.Infof("Node %s resigned", l.Cluster.Node)
}

func (l *Leadership) run(candidate *leadership.Candidate, ctx context.Context) error {
func (l *Leadership) run(ctx context.Context, candidate *leadership.Candidate) error {
electedCh, errCh := candidate.RunForElection()
for {
select {
Expand Down
4 changes: 2 additions & 2 deletions configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,10 @@ func (certs *Certificates) CreateTLSConfig() (*tls.Config, error) {
if errKey == nil {
isAPath = true
} else {
return nil, fmt.Errorf("Bad TLS Certificate KeyFile format. Expected a path.")
return nil, fmt.Errorf("bad TLS Certificate KeyFile format, expected a path")
}
} else if errKey == nil {
return nil, fmt.Errorf("Bad TLS Certificate KeyFile format. Expected a path.")
return nil, fmt.Errorf("bad TLS Certificate KeyFile format, expected a path")
}

cert := tls.Certificate{}
Expand Down
4 changes: 2 additions & 2 deletions integration/consul_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -446,9 +446,9 @@ func (s *ConsulSuite) TestDatastore(c *check.C) {
c.Assert(err, checker.IsNil)

ctx := context.Background()
datastore1, err := cluster.NewDataStore(*kvSource, ctx, &TestStruct{}, nil)
datastore1, err := cluster.NewDataStore(ctx, *kvSource, &TestStruct{}, nil)
c.Assert(err, checker.IsNil)
datastore2, err := cluster.NewDataStore(*kvSource, ctx, &TestStruct{}, nil)
datastore2, err := cluster.NewDataStore(ctx, *kvSource, &TestStruct{}, nil)
c.Assert(err, checker.IsNil)

setter1, _, err := datastore1.Begin()
Expand Down

0 comments on commit b0efd68

Please sign in to comment.