Merge pull request #848 from errm/golint

Fix golint
This commit is contained in:
Emile Vauge 2016-11-16 10:23:02 +01:00 committed by GitHub
commit 28276e1b37
6 changed files with 11 additions and 10 deletions

View file

@ -119,11 +119,12 @@ func (a *ACME) CreateClusterConfig(leadership *cluster.Leadership, tlsConfig *tl
} }
datastore, err := cluster.NewDataStore( datastore, err := cluster.NewDataStore(
leadership.Pool.Ctx(),
staert.KvSource{ staert.KvSource{
Store: leadership.Store, Store: leadership.Store,
Prefix: a.Storage, Prefix: a.Storage,
}, },
leadership.Pool.Ctx(), &Account{}, &Account{},
listener) listener)
if err != nil { if err != nil {
return err return err

View file

@ -68,7 +68,7 @@ func (t *localTransaction) Commit(object cluster.Object) error {
t.LocalStore.account = object.(*Account) t.LocalStore.account = object.(*Account)
defer t.storageLock.Unlock() defer t.storageLock.Unlock()
if t.dirty { 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 // write account to file

View file

@ -56,7 +56,7 @@ type Datastore struct {
} }
// NewDataStore creates a Datastore // 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{ datastore := Datastore{
kv: kvSource, kv: kvSource,
ctx: ctx, ctx: ctx,
@ -230,7 +230,7 @@ func (s *datastoreTransaction) Commit(object Object) error {
s.localLock.Lock() s.localLock.Lock()
defer s.localLock.Unlock() defer s.localLock.Unlock()
if s.dirty { 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 s.Datastore.meta.object = object
err := s.Datastore.meta.Marshall() err := s.Datastore.meta.Marshall()

View file

@ -39,7 +39,7 @@ func (l *Leadership) Participate(pool *safe.Pool) {
defer log.Debugf("Node %s no more running for election", l.Cluster.Node) defer log.Debugf("Node %s no more running for election", l.Cluster.Node)
backOff := backoff.NewExponentialBackOff() backOff := backoff.NewExponentialBackOff()
operation := func() error { operation := func() error {
return l.run(l.candidate, ctx) return l.run(ctx, l.candidate)
} }
notify := func(err error, time time.Duration) { notify := func(err error, time time.Duration) {
@ -63,7 +63,7 @@ func (l *Leadership) Resign() {
log.Infof("Node %s resigned", l.Cluster.Node) 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() electedCh, errCh := candidate.RunForElection()
for { for {
select { select {

View file

@ -233,10 +233,10 @@ func (certs *Certificates) CreateTLSConfig() (*tls.Config, error) {
if errKey == nil { if errKey == nil {
isAPath = true isAPath = true
} else { } 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 { } 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{} cert := tls.Certificate{}

View file

@ -446,9 +446,9 @@ func (s *ConsulSuite) TestDatastore(c *check.C) {
c.Assert(err, checker.IsNil) c.Assert(err, checker.IsNil)
ctx := context.Background() ctx := context.Background()
datastore1, err := cluster.NewDataStore(*kvSource, ctx, &TestStruct{}, nil) datastore1, err := cluster.NewDataStore(ctx, *kvSource, &TestStruct{}, nil)
c.Assert(err, checker.IsNil) 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) c.Assert(err, checker.IsNil)
setter1, _, err := datastore1.Begin() setter1, _, err := datastore1.Begin()