]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: remove unnecessary error condition on reading fingerprint
authorCherry Zhang <cherryyz@google.com>
Fri, 8 May 2020 21:12:45 +0000 (17:12 -0400)
committerCherry Zhang <cherryyz@google.com>
Tue, 18 Aug 2020 21:18:14 +0000 (21:18 +0000)
io.ReadFull guarantees n == len(buf) if and only if err == nil,
so the length check is redundant.

Change-Id: I15bff97868e27a65648acd791883cac8dab77630
Reviewed-on: https://go-review.googlesource.com/c/go/+/232988
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
src/cmd/compile/internal/gc/iimport.go

index 0eeb047c069a5016bc274d584b1fdd021df9d503..4169222c14f2b1fcf02a92e6934c80c44882e7b7 100644 (file)
@@ -191,9 +191,9 @@ func iimport(pkg *types.Pkg, in *bio.Reader) (fingerprint goobj.FingerprintType)
                }
        }
 
-       // Fingerprint
-       n, err := io.ReadFull(in, fingerprint[:])
-       if err != nil || n != len(fingerprint) {
+       // Fingerprint.
+       _, err = io.ReadFull(in, fingerprint[:])
+       if err != nil {
                yyerror("import %s: error reading fingerprint", pkg.Path)
                errorexit()
        }