fix golint issues, else blocks (#457)
This commit is contained in:
@@ -155,10 +155,10 @@ func (p *p2cPicker) choose(c1, c2 *subConn) *subConn {
|
||||
pick := atomic.LoadInt64(&c2.pick)
|
||||
if start-pick > forcePick && atomic.CompareAndSwapInt64(&c2.pick, pick, start) {
|
||||
return c2
|
||||
} else {
|
||||
atomic.StoreInt64(&c1.pick, start)
|
||||
return c1
|
||||
}
|
||||
|
||||
atomic.StoreInt64(&c1.pick, start)
|
||||
return c1
|
||||
}
|
||||
|
||||
func (p *p2cPicker) logStats() {
|
||||
@@ -196,7 +196,7 @@ func (c *subConn) load() int64 {
|
||||
load := lag * (atomic.LoadInt64(&c.inflight) + 1)
|
||||
if load == 0 {
|
||||
return penalty
|
||||
} else {
|
||||
return load
|
||||
}
|
||||
|
||||
return load
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ func subset(set []string, sub int) []string {
|
||||
})
|
||||
if len(set) <= sub {
|
||||
return set
|
||||
} else {
|
||||
return set[:sub]
|
||||
}
|
||||
|
||||
return set[:sub]
|
||||
}
|
||||
|
||||
@@ -62,9 +62,9 @@ type mockedShedder struct {
|
||||
func (m mockedShedder) Allow() (load.Promise, error) {
|
||||
if m.allow {
|
||||
return mockedPromise{}, nil
|
||||
} else {
|
||||
return nil, load.ErrServiceOverloaded
|
||||
}
|
||||
|
||||
return nil, load.ErrServiceOverloaded
|
||||
}
|
||||
|
||||
type mockedPromise struct {
|
||||
|
||||
@@ -109,9 +109,9 @@ func figureOutListenOn(listenOn string) string {
|
||||
}
|
||||
if len(ip) == 0 {
|
||||
return listenOn
|
||||
} else {
|
||||
return strings.Join(append([]string{ip}, fields[1:]...), ":")
|
||||
}
|
||||
|
||||
return strings.Join(append([]string{ip}, fields[1:]...), ":")
|
||||
}
|
||||
|
||||
func setupInterceptors(server internal.Server, c RpcServerConf, metrics *stat.Metrics) error {
|
||||
|
||||
Reference in New Issue
Block a user