mirror of https://github.com/golang/go.git
all: remove unnecessary ", _" from map reads
If the bool value isn't used, there is no need to assign to underscore - there is a shorter form that only returns the value and behaves in the exact same way. Change-Id: Iaf801b8e966da6c2f565bc39e3bb028175c92d60 Reviewed-on: https://go-review.googlesource.com/40920 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
af5c95117b
commit
bdf746caaa
|
|
@ -245,7 +245,7 @@ func (info *Info) TypeOf(e ast.Expr) Type {
|
|||
// Precondition: the Uses and Defs maps are populated.
|
||||
//
|
||||
func (info *Info) ObjectOf(id *ast.Ident) Object {
|
||||
if obj, _ := info.Defs[id]; obj != nil {
|
||||
if obj := info.Defs[id]; obj != nil {
|
||||
return obj
|
||||
}
|
||||
return info.Uses[id]
|
||||
|
|
|
|||
|
|
@ -805,7 +805,7 @@ func (t *Transport) removeIdleConnLocked(pconn *persistConn) {
|
|||
}
|
||||
t.idleLRU.remove(pconn)
|
||||
key := pconn.cacheKey
|
||||
pconns, _ := t.idleConn[key]
|
||||
pconns := t.idleConn[key]
|
||||
switch len(pconns) {
|
||||
case 0:
|
||||
// Nothing
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ func (sw *Switch) Accept4(s, flags int) (ns int, sa syscall.Sockaddr, err error)
|
|||
return syscall.Accept4(s, flags)
|
||||
}
|
||||
sw.fmu.RLock()
|
||||
f, _ := sw.fltab[FilterAccept]
|
||||
f := sw.fltab[FilterAccept]
|
||||
sw.fmu.RUnlock()
|
||||
|
||||
af, err := f.apply(so)
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ func (sw *Switch) Socket(family, sotype, proto int) (s int, err error) {
|
|||
|
||||
so := &Status{Cookie: cookie(family, sotype, proto)}
|
||||
sw.fmu.RLock()
|
||||
f, _ := sw.fltab[FilterSocket]
|
||||
f := sw.fltab[FilterSocket]
|
||||
sw.fmu.RUnlock()
|
||||
|
||||
af, err := f.apply(so)
|
||||
|
|
@ -47,7 +47,7 @@ func (sw *Switch) Close(s int) (err error) {
|
|||
return syscall.Close(s)
|
||||
}
|
||||
sw.fmu.RLock()
|
||||
f, _ := sw.fltab[FilterClose]
|
||||
f := sw.fltab[FilterClose]
|
||||
sw.fmu.RUnlock()
|
||||
|
||||
af, err := f.apply(so)
|
||||
|
|
@ -77,7 +77,7 @@ func (sw *Switch) Connect(s int, sa syscall.Sockaddr) (err error) {
|
|||
return syscall.Connect(s, sa)
|
||||
}
|
||||
sw.fmu.RLock()
|
||||
f, _ := sw.fltab[FilterConnect]
|
||||
f := sw.fltab[FilterConnect]
|
||||
sw.fmu.RUnlock()
|
||||
|
||||
af, err := f.apply(so)
|
||||
|
|
@ -106,7 +106,7 @@ func (sw *Switch) Listen(s, backlog int) (err error) {
|
|||
return syscall.Listen(s, backlog)
|
||||
}
|
||||
sw.fmu.RLock()
|
||||
f, _ := sw.fltab[FilterListen]
|
||||
f := sw.fltab[FilterListen]
|
||||
sw.fmu.RUnlock()
|
||||
|
||||
af, err := f.apply(so)
|
||||
|
|
@ -135,7 +135,7 @@ func (sw *Switch) Accept(s int) (ns int, sa syscall.Sockaddr, err error) {
|
|||
return syscall.Accept(s)
|
||||
}
|
||||
sw.fmu.RLock()
|
||||
f, _ := sw.fltab[FilterAccept]
|
||||
f := sw.fltab[FilterAccept]
|
||||
sw.fmu.RUnlock()
|
||||
|
||||
af, err := f.apply(so)
|
||||
|
|
@ -168,7 +168,7 @@ func (sw *Switch) GetsockoptInt(s, level, opt int) (soerr int, err error) {
|
|||
return syscall.GetsockoptInt(s, level, opt)
|
||||
}
|
||||
sw.fmu.RLock()
|
||||
f, _ := sw.fltab[FilterGetsockoptInt]
|
||||
f := sw.fltab[FilterGetsockoptInt]
|
||||
sw.fmu.RUnlock()
|
||||
|
||||
af, err := f.apply(so)
|
||||
|
|
|
|||
Loading…
Reference in New Issue