mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
vendor: github.com/moby/buildkit 5ae9b23c40a9 (master / v0.13.0-dev)
full diff: -36ef4d8c0d...f098008783
-d5c1d785b0...5ae9b23c40
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
18
vendor/github.com/moby/buildkit/client/llb/marshal.go
generated
vendored
18
vendor/github.com/moby/buildkit/client/llb/marshal.go
generated
vendored
@ -95,14 +95,18 @@ func MarshalConstraints(base, override *Constraints) (*pb.Op, *pb.OpMetadata) {
|
||||
c.Platform = &defaultPlatform
|
||||
}
|
||||
|
||||
opPlatform := pb.Platform{
|
||||
OS: c.Platform.OS,
|
||||
Architecture: c.Platform.Architecture,
|
||||
Variant: c.Platform.Variant,
|
||||
OSVersion: c.Platform.OSVersion,
|
||||
}
|
||||
if c.Platform.OSFeatures != nil {
|
||||
opPlatform.OSFeatures = append([]string{}, c.Platform.OSFeatures...)
|
||||
}
|
||||
|
||||
return &pb.Op{
|
||||
Platform: &pb.Platform{
|
||||
OS: c.Platform.OS,
|
||||
Architecture: c.Platform.Architecture,
|
||||
Variant: c.Platform.Variant,
|
||||
OSVersion: c.Platform.OSVersion,
|
||||
OSFeatures: c.Platform.OSFeatures,
|
||||
},
|
||||
Platform: &opPlatform,
|
||||
Constraints: &pb.WorkerConstraints{
|
||||
Filter: c.WorkerConstraints,
|
||||
},
|
||||
|
9
vendor/github.com/moby/buildkit/client/llb/state.go
generated
vendored
9
vendor/github.com/moby/buildkit/client/llb/state.go
generated
vendored
@ -258,11 +258,16 @@ func (s State) WithImageConfig(c []byte) (State, error) {
|
||||
}
|
||||
s = s.Dir(img.Config.WorkingDir)
|
||||
if img.Architecture != "" && img.OS != "" {
|
||||
s = s.Platform(ocispecs.Platform{
|
||||
plat := ocispecs.Platform{
|
||||
OS: img.OS,
|
||||
Architecture: img.Architecture,
|
||||
Variant: img.Variant,
|
||||
})
|
||||
OSVersion: img.OSVersion,
|
||||
}
|
||||
if img.OSFeatures != nil {
|
||||
plat.OSFeatures = append([]string{}, img.OSFeatures...)
|
||||
}
|
||||
s = s.Platform(plat)
|
||||
}
|
||||
return s, nil
|
||||
}
|
||||
|
63
vendor/github.com/moby/buildkit/client/solve.go
generated
vendored
63
vendor/github.com/moby/buildkit/client/solve.go
generated
vendored
@ -35,7 +35,8 @@ import (
|
||||
|
||||
type SolveOpt struct {
|
||||
Exports []ExportEntry
|
||||
LocalDirs map[string]string
|
||||
LocalDirs map[string]string // Deprecated: use LocalMounts
|
||||
LocalMounts map[string]fsutil.FS
|
||||
OCIStores map[string]content.Store
|
||||
SharedKey string
|
||||
Frontend string
|
||||
@ -90,7 +91,11 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG
|
||||
return nil, errors.New("invalid with def and cb")
|
||||
}
|
||||
|
||||
syncedDirs, err := prepareSyncedDirs(def, opt.LocalDirs)
|
||||
mounts, err := prepareMounts(&opt)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
syncedDirs, err := prepareSyncedFiles(def, mounts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -361,26 +366,23 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func prepareSyncedDirs(def *llb.Definition, localDirs map[string]string) (filesync.StaticDirSource, error) {
|
||||
for _, d := range localDirs {
|
||||
fi, err := os.Stat(d)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "could not find %s", d)
|
||||
}
|
||||
if !fi.IsDir() {
|
||||
return nil, errors.Errorf("%s not a directory", d)
|
||||
}
|
||||
}
|
||||
func prepareSyncedFiles(def *llb.Definition, localMounts map[string]fsutil.FS) (filesync.StaticDirSource, error) {
|
||||
resetUIDAndGID := func(p string, st *fstypes.Stat) fsutil.MapResult {
|
||||
st.Uid = 0
|
||||
st.Gid = 0
|
||||
return fsutil.MapResultKeep
|
||||
}
|
||||
|
||||
dirs := make(filesync.StaticDirSource, len(localDirs))
|
||||
result := make(filesync.StaticDirSource, len(localMounts))
|
||||
if def == nil {
|
||||
for name, d := range localDirs {
|
||||
dirs[name] = filesync.SyncedDir{Dir: d, Map: resetUIDAndGID}
|
||||
for name, mount := range localMounts {
|
||||
mount, err := fsutil.NewFilterFS(mount, &fsutil.FilterOpt{
|
||||
Map: resetUIDAndGID,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result[name] = mount
|
||||
}
|
||||
} else {
|
||||
for _, dt := range def.Def {
|
||||
@ -391,16 +393,22 @@ func prepareSyncedDirs(def *llb.Definition, localDirs map[string]string) (filesy
|
||||
if src := op.GetSource(); src != nil {
|
||||
if strings.HasPrefix(src.Identifier, "local://") {
|
||||
name := strings.TrimPrefix(src.Identifier, "local://")
|
||||
d, ok := localDirs[name]
|
||||
mount, ok := localMounts[name]
|
||||
if !ok {
|
||||
return nil, errors.Errorf("local directory %s not enabled", name)
|
||||
}
|
||||
dirs[name] = filesync.SyncedDir{Dir: d, Map: resetUIDAndGID}
|
||||
mount, err := fsutil.NewFilterFS(mount, &fsutil.FilterOpt{
|
||||
Map: resetUIDAndGID,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result[name] = mount
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return dirs, nil
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func defaultSessionName() string {
|
||||
@ -523,3 +531,22 @@ func parseCacheOptions(ctx context.Context, isGateway bool, opt SolveOpt) (*cach
|
||||
}
|
||||
return &res, nil
|
||||
}
|
||||
|
||||
func prepareMounts(opt *SolveOpt) (map[string]fsutil.FS, error) {
|
||||
// merge local mounts and fallback local directories together
|
||||
mounts := make(map[string]fsutil.FS)
|
||||
for k, mount := range opt.LocalMounts {
|
||||
mounts[k] = mount
|
||||
}
|
||||
for k, dir := range opt.LocalDirs {
|
||||
mount, err := fsutil.NewFS(dir)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if _, ok := mounts[k]; ok {
|
||||
return nil, errors.Errorf("local mount %s already exists", k)
|
||||
}
|
||||
mounts[k] = mount
|
||||
}
|
||||
return mounts, nil
|
||||
}
|
||||
|
2
vendor/github.com/moby/buildkit/frontend/dockerui/build.go
generated
vendored
2
vendor/github.com/moby/buildkit/frontend/dockerui/build.go
generated
vendored
@ -57,7 +57,7 @@ func (bc *Client) Build(ctx context.Context, fn BuildFunc) (*ResultBuilder, erro
|
||||
p.OSVersion = img.OSVersion
|
||||
}
|
||||
if p.OSFeatures == nil && len(img.OSFeatures) > 0 {
|
||||
p.OSFeatures = img.OSFeatures
|
||||
p.OSFeatures = append([]string{}, img.OSFeatures...)
|
||||
}
|
||||
}
|
||||
|
||||
|
16
vendor/github.com/moby/buildkit/session/filesync/diffcopy.go
generated
vendored
16
vendor/github.com/moby/buildkit/session/filesync/diffcopy.go
generated
vendored
@ -47,6 +47,22 @@ type streamWriterCloser struct {
|
||||
}
|
||||
|
||||
func (wc *streamWriterCloser) Write(dt []byte) (int, error) {
|
||||
// grpc-go has a 4MB limit on messages by default. Split large messages
|
||||
// so we don't get close to that limit.
|
||||
const maxChunkSize = 3 * 1024 * 1024
|
||||
if len(dt) > maxChunkSize {
|
||||
n1, err := wc.Write(dt[:maxChunkSize])
|
||||
if err != nil {
|
||||
return n1, err
|
||||
}
|
||||
dt = dt[maxChunkSize:]
|
||||
var n2 int
|
||||
if n2, err = wc.Write(dt); err != nil {
|
||||
return n1 + n2, err
|
||||
}
|
||||
return n1 + n2, nil
|
||||
}
|
||||
|
||||
if err := wc.ClientStream.SendMsg(&BytesMessage{Data: dt}); err != nil {
|
||||
// SendMsg return EOF on remote errors
|
||||
if errors.Is(err, io.EOF) {
|
||||
|
35
vendor/github.com/moby/buildkit/session/filesync/filesync.go
generated
vendored
35
vendor/github.com/moby/buildkit/session/filesync/filesync.go
generated
vendored
@ -35,20 +35,15 @@ type fsSyncProvider struct {
|
||||
doneCh chan error
|
||||
}
|
||||
|
||||
type SyncedDir struct {
|
||||
Dir string
|
||||
Map func(string, *fstypes.Stat) fsutil.MapResult
|
||||
}
|
||||
|
||||
type DirSource interface {
|
||||
LookupDir(string) (SyncedDir, bool)
|
||||
LookupDir(string) (fsutil.FS, bool)
|
||||
}
|
||||
|
||||
type StaticDirSource map[string]SyncedDir
|
||||
type StaticDirSource map[string]fsutil.FS
|
||||
|
||||
var _ DirSource = StaticDirSource{}
|
||||
|
||||
func (dirs StaticDirSource) LookupDir(name string) (SyncedDir, bool) {
|
||||
func (dirs StaticDirSource) LookupDir(name string) (fsutil.FS, bool) {
|
||||
dir, found := dirs[name]
|
||||
return dir, found
|
||||
}
|
||||
@ -92,15 +87,22 @@ func (sp *fsSyncProvider) handle(method string, stream grpc.ServerStream) (retEr
|
||||
dirName = name[0]
|
||||
}
|
||||
|
||||
excludes := opts[keyExcludePatterns]
|
||||
includes := opts[keyIncludePatterns]
|
||||
followPaths := opts[keyFollowPaths]
|
||||
|
||||
dir, ok := sp.dirs.LookupDir(dirName)
|
||||
if !ok {
|
||||
return InvalidSessionError{status.Errorf(codes.NotFound, "no access allowed to dir %q", dirName)}
|
||||
}
|
||||
|
||||
excludes := opts[keyExcludePatterns]
|
||||
includes := opts[keyIncludePatterns]
|
||||
|
||||
followPaths := opts[keyFollowPaths]
|
||||
dir, err := fsutil.NewFilterFS(dir, &fsutil.FilterOpt{
|
||||
ExcludePatterns: excludes,
|
||||
IncludePatterns: includes,
|
||||
FollowPaths: followPaths,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var progress progressCb
|
||||
if sp.p != nil {
|
||||
@ -113,12 +115,7 @@ func (sp *fsSyncProvider) handle(method string, stream grpc.ServerStream) (retEr
|
||||
doneCh = sp.doneCh
|
||||
sp.doneCh = nil
|
||||
}
|
||||
err := pr.sendFn(stream, fsutil.NewFS(dir.Dir, &fsutil.WalkOpt{
|
||||
ExcludePatterns: excludes,
|
||||
IncludePatterns: includes,
|
||||
FollowPaths: followPaths,
|
||||
Map: dir.Map,
|
||||
}), progress)
|
||||
err = pr.sendFn(stream, dir, progress)
|
||||
if doneCh != nil {
|
||||
if err != nil {
|
||||
doneCh <- err
|
||||
|
3
vendor/github.com/moby/buildkit/session/grpc.go
generated
vendored
3
vendor/github.com/moby/buildkit/session/grpc.go
generated
vendored
@ -7,6 +7,7 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/containerd/containerd/defaults"
|
||||
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
|
||||
"github.com/moby/buildkit/util/bklog"
|
||||
"github.com/moby/buildkit/util/grpcerrors"
|
||||
@ -44,6 +45,8 @@ func grpcClientConn(ctx context.Context, conn net.Conn) (context.Context, *grpc.
|
||||
dialOpts := []grpc.DialOption{
|
||||
dialer,
|
||||
grpc.WithTransportCredentials(insecure.NewCredentials()),
|
||||
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(defaults.DefaultMaxRecvMsgSize)),
|
||||
grpc.WithDefaultCallOptions(grpc.MaxCallSendMsgSize(defaults.DefaultMaxSendMsgSize)),
|
||||
}
|
||||
|
||||
if span := trace.SpanFromContext(ctx); span.SpanContext().IsValid() {
|
||||
|
14
vendor/github.com/moby/buildkit/session/upload/uploadprovider/provider.go
generated
vendored
14
vendor/github.com/moby/buildkit/session/upload/uploadprovider/provider.go
generated
vendored
@ -59,6 +59,20 @@ type writer struct {
|
||||
}
|
||||
|
||||
func (w *writer) Write(dt []byte) (int, error) {
|
||||
// avoid sending too big messages on grpc stream
|
||||
const maxChunkSize = 3 * 1024 * 1024
|
||||
if len(dt) > maxChunkSize {
|
||||
n1, err := w.Write(dt[:maxChunkSize])
|
||||
if err != nil {
|
||||
return n1, err
|
||||
}
|
||||
dt = dt[maxChunkSize:]
|
||||
var n2 int
|
||||
if n2, err := w.Write(dt); err != nil {
|
||||
return n1 + n2, err
|
||||
}
|
||||
return n1 + n2, nil
|
||||
}
|
||||
if err := w.SendMsg(&upload.BytesMessage{Data: dt}); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
96
vendor/github.com/moby/buildkit/solver/pb/json.go
generated
vendored
Normal file
96
vendor/github.com/moby/buildkit/solver/pb/json.go
generated
vendored
Normal file
@ -0,0 +1,96 @@
|
||||
package pb
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
func (m *Op) UnmarshalJSON(data []byte) error {
|
||||
var v struct {
|
||||
Inputs []*Input `json:"inputs,omitempty"`
|
||||
Op struct {
|
||||
*Op_Exec
|
||||
*Op_Source
|
||||
*Op_File
|
||||
*Op_Build
|
||||
*Op_Merge
|
||||
*Op_Diff
|
||||
}
|
||||
Platform *Platform `json:"platform,omitempty"`
|
||||
Constraints *WorkerConstraints `json:"constraints,omitempty"`
|
||||
}
|
||||
|
||||
if err := json.Unmarshal(data, &v); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
m.Inputs = v.Inputs
|
||||
switch {
|
||||
case v.Op.Op_Exec != nil:
|
||||
m.Op = v.Op.Op_Exec
|
||||
case v.Op.Op_Source != nil:
|
||||
m.Op = v.Op.Op_Source
|
||||
case v.Op.Op_File != nil:
|
||||
m.Op = v.Op.Op_File
|
||||
case v.Op.Op_Build != nil:
|
||||
m.Op = v.Op.Op_Build
|
||||
case v.Op.Op_Merge != nil:
|
||||
m.Op = v.Op.Op_Merge
|
||||
case v.Op.Op_Diff != nil:
|
||||
m.Op = v.Op.Op_Diff
|
||||
}
|
||||
m.Platform = v.Platform
|
||||
m.Constraints = v.Constraints
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *FileAction) UnmarshalJSON(data []byte) error {
|
||||
var v struct {
|
||||
Input InputIndex `json:"input"`
|
||||
SecondaryInput InputIndex `json:"secondaryInput"`
|
||||
Output OutputIndex `json:"output"`
|
||||
Action struct {
|
||||
*FileAction_Copy
|
||||
*FileAction_Mkfile
|
||||
*FileAction_Mkdir
|
||||
*FileAction_Rm
|
||||
}
|
||||
}
|
||||
|
||||
if err := json.Unmarshal(data, &v); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
m.Input = v.Input
|
||||
m.SecondaryInput = v.SecondaryInput
|
||||
m.Output = v.Output
|
||||
switch {
|
||||
case v.Action.FileAction_Copy != nil:
|
||||
m.Action = v.Action.FileAction_Copy
|
||||
case v.Action.FileAction_Mkfile != nil:
|
||||
m.Action = v.Action.FileAction_Mkfile
|
||||
case v.Action.FileAction_Mkdir != nil:
|
||||
m.Action = v.Action.FileAction_Mkdir
|
||||
case v.Action.FileAction_Rm != nil:
|
||||
m.Action = v.Action.FileAction_Rm
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *UserOpt) UnmarshalJSON(data []byte) error {
|
||||
var v struct {
|
||||
User struct {
|
||||
*UserOpt_ByName
|
||||
*UserOpt_ByID
|
||||
}
|
||||
}
|
||||
|
||||
if err := json.Unmarshal(data, &v); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
switch {
|
||||
case v.User.UserOpt_ByName != nil:
|
||||
m.User = v.User.UserOpt_ByName
|
||||
case v.User.UserOpt_ByID != nil:
|
||||
m.User = v.User.UserOpt_ByID
|
||||
}
|
||||
return nil
|
||||
}
|
4
vendor/github.com/moby/buildkit/solver/pb/ops.pb.go
generated
vendored
4
vendor/github.com/moby/buildkit/solver/pb/ops.pb.go
generated
vendored
@ -151,6 +151,7 @@ func (CacheSharingOpt) EnumDescriptor() ([]byte, []int) {
|
||||
|
||||
// Op represents a vertex of the LLB DAG.
|
||||
type Op struct {
|
||||
// changes to this structure must be represented in json.go.
|
||||
// inputs is a set of input edges.
|
||||
Inputs []*Input `protobuf:"bytes,1,rep,name=inputs,proto3" json:"inputs,omitempty"`
|
||||
// Types that are valid to be assigned to Op:
|
||||
@ -1961,6 +1962,7 @@ func (m *FileOp) GetActions() []*FileAction {
|
||||
}
|
||||
|
||||
type FileAction struct {
|
||||
// changes to this structure must be represented in json.go.
|
||||
Input InputIndex `protobuf:"varint,1,opt,name=input,proto3,customtype=InputIndex" json:"input"`
|
||||
SecondaryInput InputIndex `protobuf:"varint,2,opt,name=secondaryInput,proto3,customtype=InputIndex" json:"secondaryInput"`
|
||||
Output OutputIndex `protobuf:"varint,3,opt,name=output,proto3,customtype=OutputIndex" json:"output"`
|
||||
@ -2482,6 +2484,8 @@ func (m *ChownOpt) GetGroup() *UserOpt {
|
||||
}
|
||||
|
||||
type UserOpt struct {
|
||||
// changes to this structure must be represented in json.go.
|
||||
//
|
||||
// Types that are valid to be assigned to User:
|
||||
//
|
||||
// *UserOpt_ByName
|
||||
|
5
vendor/github.com/moby/buildkit/solver/pb/ops.proto
generated
vendored
5
vendor/github.com/moby/buildkit/solver/pb/ops.proto
generated
vendored
@ -10,6 +10,7 @@ option (gogoproto.stable_marshaler_all) = true;
|
||||
|
||||
// Op represents a vertex of the LLB DAG.
|
||||
message Op {
|
||||
// changes to this structure must be represented in json.go.
|
||||
// inputs is a set of input edges.
|
||||
repeated Input inputs = 1;
|
||||
oneof op {
|
||||
@ -29,7 +30,7 @@ message Platform {
|
||||
string Architecture = 1;
|
||||
string OS = 2;
|
||||
string Variant = 3;
|
||||
string OSVersion = 4; // unused
|
||||
string OSVersion = 4;
|
||||
repeated string OSFeatures = 5; // unused
|
||||
}
|
||||
|
||||
@ -288,6 +289,7 @@ message FileOp {
|
||||
}
|
||||
|
||||
message FileAction {
|
||||
// changes to this structure must be represented in json.go.
|
||||
int64 input = 1 [(gogoproto.customtype) = "InputIndex", (gogoproto.nullable) = false]; // could be real input or target (target index + max input index)
|
||||
int64 secondaryInput = 2 [(gogoproto.customtype) = "InputIndex", (gogoproto.nullable) = false]; // --//--
|
||||
int64 output = 3 [(gogoproto.customtype) = "OutputIndex", (gogoproto.nullable) = false];
|
||||
@ -373,6 +375,7 @@ message ChownOpt {
|
||||
}
|
||||
|
||||
message UserOpt {
|
||||
// changes to this structure must be represented in json.go.
|
||||
oneof user {
|
||||
NamedUserOpt byName = 1;
|
||||
uint32 byID = 2;
|
||||
|
14
vendor/github.com/moby/buildkit/solver/pb/platform.go
generated
vendored
14
vendor/github.com/moby/buildkit/solver/pb/platform.go
generated
vendored
@ -5,23 +5,29 @@ import (
|
||||
)
|
||||
|
||||
func (p *Platform) Spec() ocispecs.Platform {
|
||||
return ocispecs.Platform{
|
||||
result := ocispecs.Platform{
|
||||
OS: p.OS,
|
||||
Architecture: p.Architecture,
|
||||
Variant: p.Variant,
|
||||
OSVersion: p.OSVersion,
|
||||
OSFeatures: p.OSFeatures,
|
||||
}
|
||||
if p.OSFeatures != nil {
|
||||
result.OSFeatures = append([]string{}, p.OSFeatures...)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func PlatformFromSpec(p ocispecs.Platform) Platform {
|
||||
return Platform{
|
||||
result := Platform{
|
||||
OS: p.OS,
|
||||
Architecture: p.Architecture,
|
||||
Variant: p.Variant,
|
||||
OSVersion: p.OSVersion,
|
||||
OSFeatures: p.OSFeatures,
|
||||
}
|
||||
if p.OSFeatures != nil {
|
||||
result.OSFeatures = append([]string{}, p.OSFeatures...)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func ToSpecPlatforms(p []Platform) []ocispecs.Platform {
|
||||
|
2
vendor/github.com/moby/buildkit/util/progress/multiwriter.go
generated
vendored
2
vendor/github.com/moby/buildkit/util/progress/multiwriter.go
generated
vendored
@ -18,6 +18,8 @@ type MultiWriter struct {
|
||||
meta map[string]interface{}
|
||||
}
|
||||
|
||||
var _ rawProgressWriter = &MultiWriter{}
|
||||
|
||||
func NewMultiWriter(opts ...WriterOption) *MultiWriter {
|
||||
mw := &MultiWriter{
|
||||
writers: map[rawProgressWriter]struct{}{},
|
||||
|
2
vendor/github.com/moby/buildkit/util/stack/stack.pb.go
generated
vendored
2
vendor/github.com/moby/buildkit/util/stack/stack.pb.go
generated
vendored
@ -1,6 +1,6 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.30.0
|
||||
// protoc-gen-go v1.31.0
|
||||
// protoc v3.11.4
|
||||
// source: stack.proto
|
||||
|
||||
|
5
vendor/github.com/moby/buildkit/util/system/atime_windows.go
generated
vendored
5
vendor/github.com/moby/buildkit/util/system/atime_windows.go
generated
vendored
@ -1,16 +1,17 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
iofs "io/fs"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func Atime(st iofs.FileInfo) (time.Time, error) {
|
||||
stSys, ok := st.Sys().(*syscall.Win32FileAttributeData)
|
||||
if !ok {
|
||||
return time.Time{}, fmt.Errorf("expected st.Sys() to be *syscall.Win32FileAttributeData, got %T", st.Sys())
|
||||
return time.Time{}, errors.Errorf("expected st.Sys() to be *syscall.Win32FileAttributeData, got %T", st.Sys())
|
||||
}
|
||||
// ref: https://github.com/golang/go/blob/go1.19.2/src/os/types_windows.go#L230
|
||||
return time.Unix(0, stSys.LastAccessTime.Nanoseconds()), nil
|
||||
|
Reference in New Issue
Block a user