cmd/go/internal/cacheprog: drop Request.ObjectID

ObjectID was a misnaming of OutputID from cacheprog's initial
implementation. It was maintained for compatibility with existing
cacheprog users in 1.24 but can be removed in 1.25.

Updates #64876

Change-Id: I8ff53bc581c16b7739e1cfbaa8bd35d285d3231d
Reviewed-on: https://go-review.googlesource.com/c/go/+/649435
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Dan Peterson 2025-02-13 17:09:23 -04:00 committed by Michael Matloob
parent a2c959fe97
commit f2ac0ae8bb
3 changed files with 2 additions and 22 deletions

View File

@ -59,7 +59,7 @@ type Cache interface {
// background cleanup work started earlier. Any cache trimming in one
// process should not cause the invariants of this interface to be
// violated in another process. Namely, a cache trim from one process should
// not delete an ObjectID from disk that was recently Get or Put from
// not delete an OutputID from disk that was recently Get or Put from
// another process. As a rule of thumb, don't trim things used in the last
// day.
Close() error

View File

@ -15,7 +15,6 @@ import (
"encoding/json"
"errors"
"fmt"
"internal/goexperiment"
"io"
"log"
"os"
@ -330,18 +329,10 @@ func (c *ProgCache) Put(a ActionID, file io.ReadSeeker) (_ OutputID, size int64,
return out, size, nil
}
// For compatibility with Go 1.23/1.24 GOEXPERIMENT=gocacheprog users, also
// populate the deprecated ObjectID field. This will be removed in Go 1.25.
var deprecatedValue []byte
if goexperiment.CacheProg {
deprecatedValue = out[:]
}
res, err := c.send(c.ctx, &cacheprog.Request{
Command: cacheprog.CmdPut,
ActionID: a[:],
OutputID: out[:],
ObjectID: deprecatedValue, // TODO(bradfitz): remove in Go 1.25
Body: file,
BodySize: size,
})

View File

@ -76,9 +76,6 @@ type Request struct {
ActionID []byte `json:",omitempty"` // or nil if not used
// OutputID is stored with the body for "put" requests.
//
// Prior to Go 1.24, when GOCACHEPROG was still an experiment, this was
// accidentally named ObjectID. It was renamed to OutputID in Go 1.24.
OutputID []byte `json:",omitempty"` // or nil if not used
// Body is the body for "put" requests. It's sent after the JSON object
@ -91,14 +88,6 @@ type Request struct {
// BodySize is the number of bytes of Body. If zero, the body isn't written.
BodySize int64 `json:",omitempty"`
// ObjectID is the accidental spelling of OutputID that was used prior to Go
// 1.24.
//
// Deprecated: use OutputID. This field is only populated temporarily for
// backwards compatibility with Go 1.23 and earlier when
// GOEXPERIMENT=gocacheprog is set. It will be removed in Go 1.25.
ObjectID []byte `json:",omitempty"`
}
// Response is the JSON response from the child process to the go command.
@ -125,7 +114,7 @@ type Response struct {
// For "get" requests.
Miss bool `json:",omitempty"` // cache miss
OutputID []byte `json:",omitempty"` // the ObjectID stored with the body
OutputID []byte `json:",omitempty"` // the OutputID stored with the body
Size int64 `json:",omitempty"` // body size in bytes
Time *time.Time `json:",omitempty"` // when the object was put in the cache (optional; used for cache expiration)