fix golint issues, else blocks (#457)

This commit is contained in:
Kevin Wan
2021-02-09 13:50:21 +08:00
committed by GitHub
parent 42883d0899
commit 5e969cbef0
66 changed files with 341 additions and 311 deletions

View File

@@ -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
}

View File

@@ -8,7 +8,7 @@ func subset(set []string, sub int) []string {
})
if len(set) <= sub {
return set
} else {
return set[:sub]
}
return set[:sub]
}

View File

@@ -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 {

View File

@@ -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 {