Skip to content

Commit

Permalink
[DO NOT MERGE] use fsutil's fork
Browse files Browse the repository at this point in the history
Signed-off-by: Kazuyoshi Kato <[email protected]>
  • Loading branch information
kzys committed Nov 18, 2023
1 parent 2ccd51e commit cf93d24
Show file tree
Hide file tree
Showing 29 changed files with 447 additions and 1,445 deletions.
6 changes: 3 additions & 3 deletions client/llb/definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type DefinitionOp struct {
mu sync.Mutex
ops map[digest.Digest]*pb.Op
defs map[digest.Digest][]byte
metas map[digest.Digest]pb.OpMetadata
metas map[digest.Digest]*pb.OpMetadata
sources map[digest.Digest][]*SourceLocation
platforms map[digest.Digest]*ocispecs.Platform
dgst digest.Digest
Expand Down Expand Up @@ -98,7 +98,7 @@ func NewDefinitionOp(def *pb.Definition) (*DefinitionOp, error) {
return &DefinitionOp{
ops: ops,
defs: defs,
metas: util.FromPointerMap[digest.Digest](def.Metadata),
metas: util.FromStringMap[digest.Digest](def.Metadata),
sources: srcs,
platforms: platforms,
dgst: dgst,
Expand Down Expand Up @@ -165,7 +165,7 @@ func (d *DefinitionOp) Marshal(ctx context.Context, c *Constraints) (digest.Dige
defer d.mu.Unlock()

meta := d.metas[d.dgst]
return d.dgst, d.defs[d.dgst], &meta, d.sources[d.dgst], nil
return d.dgst, d.defs[d.dgst], meta, d.sources[d.dgst], nil
}

func (d *DefinitionOp) Output() Output {
Expand Down
12 changes: 6 additions & 6 deletions client/llb/fileop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -693,24 +693,24 @@ func TestFileCreatedTime(t *testing.T) {
require.Equal(t, dt3.UnixNano(), copy.Timestamp)
}

func parseDef(t *testing.T, def [][]byte) (map[digest.Digest]pb.Op, []pb.Op) {
m := map[digest.Digest]pb.Op{}
arr := make([]pb.Op, 0, len(def))
func parseDef(t *testing.T, def [][]byte) (map[digest.Digest]*pb.Op, []*pb.Op) {
m := map[digest.Digest]*pb.Op{}
arr := make([]*pb.Op, 0, len(def))

for _, dt := range def {
var op pb.Op
err := proto.Unmarshal(dt, &op)
require.NoError(t, err)
dgst := digest.FromBytes(dt)
m[dgst] = op
arr = append(arr, op)
m[dgst] = &op
arr = append(arr, &op)
// fmt.Printf(":: %T %+v\n", op.Op, op)
}

return m, arr
}

func last(t *testing.T, arr []pb.Op) (digest.Digest, int) {
func last(t *testing.T, arr []*pb.Op) (digest.Digest, int) {
require.True(t, len(arr) > 1)

op := arr[len(arr)-1]
Expand Down
8 changes: 4 additions & 4 deletions client/llb/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ func ulimit(name UlimitName, soft int64, hard int64) StateOption {
if err != nil {
return nil, err
}
return append(v, pb.Ulimit{
return append(v, &pb.Ulimit{
Name: string(name),
Soft: soft,
Hard: hard,
Expand All @@ -270,14 +270,14 @@ func ulimit(name UlimitName, soft int64, hard int64) StateOption {
}
}

func getUlimit(s State) func(context.Context, *Constraints) ([]pb.Ulimit, error) {
return func(ctx context.Context, c *Constraints) ([]pb.Ulimit, error) {
func getUlimit(s State) func(context.Context, *Constraints) ([]*pb.Ulimit, error) {
return func(ctx context.Context, c *Constraints) ([]*pb.Ulimit, error) {
v, err := s.getValue(keyUlimit)(ctx, c)
if err != nil {
return nil, err
}
if v != nil {
return v.([]pb.Ulimit), nil
return v.([]*pb.Ulimit), nil
}
return nil, nil
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/buildctl/debug/dumpllb.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func dumpLLB(clicontext *cli.Context) error {
}

type llbOp struct {
Op pb.Op
Op *pb.Op
Digest digest.Digest
OpMetadata *pb.OpMetadata
}
Expand All @@ -75,7 +75,7 @@ func loadLLB(r io.Reader) ([]llbOp, error) {
return nil, errors.Wrap(err, "failed to parse op")
}
dgst := digest.FromBytes(dt)
ent := llbOp{Op: op, Digest: dgst, OpMetadata: def.Metadata[dgst]}
ent := llbOp{Op: &op, Digest: dgst, OpMetadata: def.Metadata[dgst]}
ops = append(ops, ent)
}
return ops, nil
Expand Down Expand Up @@ -104,7 +104,7 @@ func writeDot(ops []llbOp, w io.Writer) {
}
}

func attr(dgst digest.Digest, op pb.Op) (string, string) {
func attr(dgst digest.Digest, op *pb.Op) (string, string) {
switch op := op.Op.(type) {
case *pb.Op_Source:
return op.Source.Identifier, "ellipse"
Expand Down
2 changes: 1 addition & 1 deletion control/control.go
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ func (c *Controller) ListWorkers(ctx context.Context, r *controlapi.ListWorkersR
resp.Record = append(resp.Record, &apitypes.WorkerRecord{
ID: w.ID(),
Labels: w.Labels(),
Platforms: util.ToPointerSlice(pb.PlatformsFromSpec(w.Platforms(true))),
Platforms: pb.PlatformsFromSpec(w.Platforms(true)),
GCPolicy: toPBGCPolicy(w.GCPolicy()),
BuildkitVersion: toPBBuildkitVersion(w.BuildkitVersion()),
})
Expand Down
2 changes: 1 addition & 1 deletion frontend/dockerfile/dockerfile2llb/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ type dispatchOpt struct {
buildPlatforms []ocispecs.Platform
extraHosts []llb.HostIP
shmSize int64
ulimit []pb.Ulimit
ulimit []*pb.Ulimit
cgroupParent string
llbCaps *apicaps.CapSet
sourceMap *llb.SourceMap
Expand Down
6 changes: 3 additions & 3 deletions frontend/dockerui/attr.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ func parseShmSize(v string) (int64, error) {
return kb, nil
}

func parseUlimits(v string) ([]pb.Ulimit, error) {
func parseUlimits(v string) ([]*pb.Ulimit, error) {
if v == "" {
return nil, nil
}
out := make([]pb.Ulimit, 0)
out := make([]*pb.Ulimit, 0)
csvReader := csv.NewReader(strings.NewReader(v))
fields, err := csvReader.Read()
if err != nil {
Expand All @@ -90,7 +90,7 @@ func parseUlimits(v string) ([]pb.Ulimit, error) {
if err != nil {
return nil, err
}
out = append(out, pb.Ulimit{
out = append(out, &pb.Ulimit{
Name: ulimit.Name,
Soft: ulimit.Soft,
Hard: ulimit.Hard,
Expand Down
4 changes: 2 additions & 2 deletions frontend/dockerui/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ type Config struct {
NetworkMode pb.NetMode
ShmSize int64
Target string
Ulimits []pb.Ulimit
Ulimits []*pb.Ulimit

CacheImports []client.CacheOptionsEntry
TargetPlatforms []ocispecs.Platform // nil means default
Expand Down Expand Up @@ -218,7 +218,7 @@ func (bc *Client) init() error {
var cacheImports []client.CacheOptionsEntry
// new API
if cacheImportsStr := opts[keyCacheImports]; cacheImportsStr != "" {
var cacheImportsUM []controlapi.CacheOptionsEntry
var cacheImportsUM []*controlapi.CacheOptionsEntry
if err := json.Unmarshal([]byte(cacheImportsStr), &cacheImportsUM); err != nil {
return errors.Wrapf(err, "failed to unmarshal %s (%q)", keyCacheImports, cacheImportsStr)
}
Expand Down
6 changes: 3 additions & 3 deletions frontend/gateway/container/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ type Mount struct {
func NewContainer(ctx context.Context, w worker.Worker, sm *session.Manager, g session.Group, req NewContainerRequest) (client.Container, error) {
ctx, cancel := context.WithCancel(ctx)
eg, ctx := errgroup.WithContext(ctx)
platform := opspb.Platform{
platform := &opspb.Platform{
OS: runtime.GOOS,
Architecture: runtime.GOARCH,
}
if req.Platform != nil {
platform = *req.Platform
platform = req.Platform
}
ctr := &gatewayContainer{
id: req.ContainerID,
Expand Down Expand Up @@ -289,7 +289,7 @@ type gatewayContainer struct {
netMode opspb.NetMode
hostname string
extraHosts []executor.HostIP
platform opspb.Platform
platform *opspb.Platform
rootFS executor.Mount
mounts []executor.Mount
executor executor.Executor
Expand Down
3 changes: 1 addition & 2 deletions frontend/gateway/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import (
"github.com/moby/buildkit/solver/errdefs"
llberrdefs "github.com/moby/buildkit/solver/llbsolver/errdefs"
opspb "github.com/moby/buildkit/solver/pb"
"github.com/moby/buildkit/util"
"github.com/moby/buildkit/util/apicaps"
"github.com/moby/buildkit/util/bklog"
"github.com/moby/buildkit/util/grpcerrors"
Expand Down Expand Up @@ -902,7 +901,7 @@ func (lbf *llbBridgeForwarder) Ping(context.Context, *pb.PingRequest) (*pb.PongR
pbWorkers = append(pbWorkers, &apitypes.WorkerRecord{
ID: w.ID,
Labels: w.Labels,
Platforms: util.ToPointerSlice(opspb.PlatformsFromSpec(w.Platforms)),
Platforms: opspb.PlatformsFromSpec(w.Platforms),
})
}

Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,5 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
kernel.org/pub/linux/libs/security/libcap/psx v1.2.67 // indirect
)

replace github.com/tonistiigi/fsutil => github.com/kzys/fsutil v0.0.0-20231117161108-e49ae8a62b08
14 changes: 7 additions & 7 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ github.com/Microsoft/go-winio v0.4.15/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59
github.com/Microsoft/go-winio v0.4.16-0.20201130162521-d1ffc52c7331/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0=
github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0=
github.com/Microsoft/go-winio v0.4.17-0.20210211115548-6eac466e5fa3/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84=
github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY=
github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow=
github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=
github.com/Microsoft/hcsshim v0.8.6/go.mod h1:Op3hHsoHPAvb6lceZHDtd9OkTew38wNoXnJs8iY7rUg=
Expand Down Expand Up @@ -328,6 +329,7 @@ github.com/containerd/continuity v0.0.0-20191127005431-f65d91d395eb/go.mod h1:GL
github.com/containerd/continuity v0.0.0-20200710164510-efbc4488d8fe/go.mod h1:cECdGN1O8G9bgKTlLhuPJimka6Xb/Gg7vYzCTNVxhvo=
github.com/containerd/continuity v0.0.0-20201208142359-180525291bb7/go.mod h1:kR3BEg7bDFaEddKm54WSmrol1fKWDU1nKYkgrcgZT7Y=
github.com/containerd/continuity v0.0.0-20210208174643-50096c924a4e/go.mod h1:EXlVlkqNba9rJe3j7w3Xa924itAMLgZH4UD/Q4PExuQ=
github.com/containerd/continuity v0.4.1/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ=
github.com/containerd/continuity v0.4.2 h1:v3y/4Yz5jwnvqPKJJ+7Wf93fyWoCB3F5EclWG023MDM=
github.com/containerd/continuity v0.4.2/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ=
github.com/containerd/fifo v0.0.0-20180307165137-3d5202aec260/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI=
Expand Down Expand Up @@ -440,7 +442,6 @@ github.com/docker/distribution v0.0.0-20190905152932-14b96e55d84c/go.mod h1:0+TT
github.com/docker/distribution v2.6.0-rc.1.0.20180327202408-83389a148052+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/docker v0.0.0-20200511152416-a93e9eb0e95c/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker v0.7.3-0.20190327010347-be7ac8be2ae0/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker v1.4.2-0.20180531152204-71cd53e4a197/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker v1.4.2-0.20190924003213-a8608b5b67c7/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
Expand Down Expand Up @@ -848,6 +849,8 @@ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/kzys/fsutil v0.0.0-20231117161108-e49ae8a62b08 h1:u+EpfiXDJ1MLeTOvNWa94H/H5GUI8J7LYtzTy4aWD1o=
github.com/kzys/fsutil v0.0.0-20231117161108-e49ae8a62b08/go.mod h1:2YyuTs3fk0gBphrfnPtvj5NC+UDID5NW2F0esonDF6U=
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
Expand Down Expand Up @@ -909,9 +912,9 @@ github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQ
github.com/moby/buildkit v0.8.1/go.mod h1:/kyU1hKy/aYCuP39GZA9MaKioovHku57N6cqlKZIaiQ=
github.com/moby/locker v1.0.1 h1:fOXqR41zeveg4fFODix+1Ch4mj/gT0NE1XJbp/epuBg=
github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc=
github.com/moby/patternmatcher v0.5.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc=
github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk=
github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc=
github.com/moby/sys/mount v0.1.0/go.mod h1:FVQFLDRWwyBjDTBNQXDlWnSFREqOo3OKX9aqhmeoo74=
github.com/moby/sys/mount v0.1.1/go.mod h1:FVQFLDRWwyBjDTBNQXDlWnSFREqOo3OKX9aqhmeoo74=
github.com/moby/sys/mount v0.3.3 h1:fX1SVkXFJ47XWDoeFW4Sq7PdQJnV2QIDZAqjNqgEjUs=
github.com/moby/sys/mount v0.3.3/go.mod h1:PBaEorSNTLG5t/+4EgukEQVlAvVEc6ZjTySwKdqp5K0=
Expand Down Expand Up @@ -992,7 +995,6 @@ github.com/opencontainers/image-spec v1.1.0-rc5 h1:Ygwkfw9bpDvs+c9E34SdgGOj41dX/
github.com/opencontainers/image-spec v1.1.0-rc5/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8=
github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
github.com/opencontainers/runc v1.0.0-rc10/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
github.com/opencontainers/runc v1.0.0-rc8.0.20190926000215-3e425f80a8c9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
github.com/opencontainers/runc v1.0.0-rc9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
github.com/opencontainers/runc v1.0.0-rc92/go.mod h1:X1zlU4p7wOlX4+WRCz+hvlRv8phdL7UqbYD+vQwNMmE=
Expand Down Expand Up @@ -1211,9 +1213,6 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/tommy-muehle/go-mnd v1.1.1/go.mod h1:dSUh0FtTP8VhvkL1S+gUR1OKd9ZnSaozuI6r3m6wOig=
github.com/tommy-muehle/go-mnd v1.3.1-0.20200224220436-e6f9a994e8fa/go.mod h1:dSUh0FtTP8VhvkL1S+gUR1OKd9ZnSaozuI6r3m6wOig=
github.com/tonistiigi/fsutil v0.0.0-20201103201449-0834f99b7b85/go.mod h1:a7cilN64dG941IOXfhJhlH0qB92hxJ9A1ewrdUmJ6xo=
github.com/tonistiigi/fsutil v0.0.0-20230825212630-f09800878302 h1:ZT8ibgassurSISJ1Pj26NsM3vY2jxFZn63Nd/TpHmRw=
github.com/tonistiigi/fsutil v0.0.0-20230825212630-f09800878302/go.mod h1:9kMVqMyQ/Sx2df5LtnGG+nbrmiZzCS7V6gjW3oGHsvI=
github.com/tonistiigi/go-actions-cache v0.0.0-20220404170428-0bdeb6e1eac7 h1:8eY6m1mjgyB8XySUR7WvebTM8D/Vs86jLJzD/Tw7zkc=
github.com/tonistiigi/go-actions-cache v0.0.0-20220404170428-0bdeb6e1eac7/go.mod h1:qqvyZqkfwkoJuPU/bw61bItaoO0SJ8YSW0vSVRRvsRg=
github.com/tonistiigi/go-archvariant v1.0.0 h1:5LC1eDWiBNflnTF1prCiX09yfNHIxDC/aukdhCdTyb0=
Expand Down Expand Up @@ -1456,6 +1455,8 @@ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down Expand Up @@ -1528,7 +1529,6 @@ golang.org/x/sys v0.0.0-20200817155316-9781c653f443/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200831180312-196b9ba8737a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200916030750-2334cc1a136f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200917073148-efd3b9a0ff20/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200922070232-aee5d888a860/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201013081832-0aaa2718063a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand Down
8 changes: 4 additions & 4 deletions solver/pb/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func (p *Platform) Spec() ocispecs.Platform {
return result
}

func PlatformFromSpec(p ocispecs.Platform) Platform {
func PlatformFromSpec(p ocispecs.Platform) *Platform {
result := Platform{
OS: p.OS,
Architecture: p.Architecture,
Expand All @@ -27,7 +27,7 @@ func PlatformFromSpec(p ocispecs.Platform) Platform {
if p.OSFeatures != nil {
result.OSFeatures = append([]string{}, p.OSFeatures...)
}
return result
return &result
}

func ToSpecPlatforms(p []*Platform) []ocispecs.Platform {
Expand All @@ -38,8 +38,8 @@ func ToSpecPlatforms(p []*Platform) []ocispecs.Platform {
return out
}

func PlatformsFromSpec(p []ocispecs.Platform) []Platform {
out := make([]Platform, 0, len(p))
func PlatformsFromSpec(p []ocispecs.Platform) []*Platform {
out := make([]*Platform, 0, len(p))
for _, pp := range p {
out = append(out, PlatformFromSpec(pp))
}
Expand Down
12 changes: 2 additions & 10 deletions util/proto.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,10 @@ func ToPointerSlice[T any](from []T) []*T {
return result
}

func FromPointerMap[K ~string, V any](from map[string]*V) map[K]V {
func FromStringMap[K ~string, V any](from map[string]V) map[K]V {
result := make(map[K]V)
for k, v := range from {
result[K(k)] = *v
}
return result
}

func ToPointerMap[K ~string, V any](from map[K]V) map[string]*V {
result := make(map[string]*V)
for k, v := range from {
result[string(k)] = &v
result[K(k)] = v
}
return result
}
Expand Down
18 changes: 18 additions & 0 deletions vendor/github.com/tonistiigi/fsutil/clone.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit cf93d24

Please sign in to comment.