cmd/go: fix potention deadlock

Change-Id: I5cc0c9d69c56c6746e03c7ae2f6c0e49c8dbc7e4
GitHub-Last-Rev: b12cee8f97
GitHub-Pull-Request: golang/go#78885
Reviewed-on: https://go-review.googlesource.com/c/go/+/769320
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Weixie Cui 2026-04-21 12:57:41 +00:00 committed by Gopher Robot
parent b32283b27b
commit 66843181d1

View file

@ -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++