mirror of
https://github.com/golang/go.git
synced 2026-06-27 03:11:23 +00:00
cmd/go: fix length is not equal cause bytes.Equal never return true
Change-Id: I62d4e2277ba01480985b6df0c1e222964e89bf4d
GitHub-Last-Rev: c0867661c4
GitHub-Pull-Request: golang/go#78950
Reviewed-on: https://go-review.googlesource.com/c/go/+/770640
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>
This commit is contained in:
parent
caeb5b7b66
commit
b32283b27b
1 changed files with 1 additions and 1 deletions
|
|
@ -781,7 +781,7 @@ func rewriteVersionList(ctx context.Context, dir string) (err error) {
|
|||
}
|
||||
if fi, err := f.Stat(); err == nil && int(fi.Size()) == buf.Len() {
|
||||
old := make([]byte, buf.Len()+1)
|
||||
if n, err := f.ReadAt(old, 0); err == io.EOF && n == buf.Len() && bytes.Equal(buf.Bytes(), old) {
|
||||
if n, err := f.ReadAt(old, 0); err == io.EOF && n == buf.Len() && bytes.Equal(buf.Bytes(), old[:n]) {
|
||||
return nil // No edit needed.
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue