]> Cypherpunks repositories - gostls13.git/commitdiff
go/internal/gcimporter: simplify defer
authorTobias Klauser <tklauser@distanz.ch>
Fri, 9 Mar 2018 10:35:18 +0000 (11:35 +0100)
committerTobias Klauser <tobias.klauser@gmail.com>
Fri, 9 Mar 2018 15:00:06 +0000 (15:00 +0000)
Directly use rc.Close instead of wrapping it with a closure.

Change-Id: I3dc1c21ccbfe031c230b035126d5ea3bc62055c3
Reviewed-on: https://go-review.googlesource.com/99716
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/go/internal/gcimporter/gcimporter.go

index 2185f5b89105389316769189d67ff5899cd9ca7f..cf89fcd1b4f6bdbfa2666918951c52344b2921f2 100644 (file)
@@ -133,9 +133,7 @@ func Import(packages map[string]*types.Package, path, srcDir string, lookup func
                }()
                rc = f
        }
-       defer func() {
-               rc.Close()
-       }()
+       defer rc.Close()
 
        var hdr string
        buf := bufio.NewReader(rc)