]> Cypherpunks repositories - gostls13.git/commitdiff
all: remove unnecessary ", _" from map reads
authorDaniel Martí <mvdan@mvdan.cc>
Tue, 18 Apr 2017 11:32:05 +0000 (12:32 +0100)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 18 Apr 2017 15:29:10 +0000 (15:29 +0000)
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>
src/go/types/api.go
src/net/http/transport.go
src/net/internal/socktest/sys_cloexec.go
src/net/internal/socktest/sys_unix.go

index 7202828f32a40dab0c4623deacb4bdcad87013c6..11e76867a1f74fb20e4dad26aa685bb31c57e6b0 100644 (file)
@@ -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]
index 5be7488d6d96affc916d654cc2ffd5f28c160e55..425db360182280f7c8c81fbf25f127f89f7b9086 100644 (file)
@@ -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
index 007710c486a5cbda53212f773f92d2d2807948b9..d1b8f4f374998e220fc312023479e7599b8005a5 100644 (file)
@@ -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)
index f983e266f16fea934da436a1b4f5ddbd06e858e8..9fe86b55cfde746f666ef43c137d9bdbfd8fba8b 100644 (file)
@@ -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)