From 84a62453e5c01df3f7d0c48d9aca32832c2052c1 Mon Sep 17 00:00:00 2001 From: Cherry Zhang Date: Fri, 8 May 2020 17:12:45 -0400 Subject: [PATCH] cmd/compile: remove unnecessary error condition on reading fingerprint 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 TryBot-Result: Gobot Gobot Reviewed-by: Dmitri Shuralyov --- src/cmd/compile/internal/gc/iimport.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cmd/compile/internal/gc/iimport.go b/src/cmd/compile/internal/gc/iimport.go index 0eeb047c06..4169222c14 100644 --- a/src/cmd/compile/internal/gc/iimport.go +++ b/src/cmd/compile/internal/gc/iimport.go @@ -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() } -- 2.50.0