diff --git a/src/cmd/go/internal/cache/prog.go b/src/cmd/go/internal/cache/prog.go index 0f51021298bbc7..cbd495642cb9c5 100644 --- a/src/cmd/go/internal/cache/prog.go +++ b/src/cmd/go/internal/cache/prog.go @@ -204,6 +204,7 @@ func (c *ProgCache) send(ctx context.Context, req *cacheprog.Request) (*cachepro func (c *ProgCache) writeToChild(req *cacheprog.Request, resc chan<- *cacheprog.Response) (err error) { c.mu.Lock() if c.inFlight == nil { + c.mu.Unlock() return errCacheprogClosed } c.nextID++ diff --git a/src/cmd/go/internal/modfetch/cache.go b/src/cmd/go/internal/modfetch/cache.go index 4d7e2b1bfc88b3..2e6e7a5048034b 100644 --- a/src/cmd/go/internal/modfetch/cache.go +++ b/src/cmd/go/internal/modfetch/cache.go @@ -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. } } diff --git a/src/html/template/transition.go b/src/html/template/transition.go index ea4b272cc241db..05b6abd03d1772 100644 --- a/src/html/template/transition.go +++ b/src/html/template/transition.go @@ -426,7 +426,7 @@ func tJSDelimited(c context, s []byte) (context, int) { // If " 0 && i+7 <= len(s) && bytes.Equal(bytes.ToLower(s[i-1:i+7]), []byte(" 0 && i+7 <= len(s) && bytes.EqualFold(s[i-1:i+7], []byte("