vendor: update buildkit to v0.16.0-rc1

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2024-09-04 16:58:37 +02:00
parent e58a1d35d1
commit 7bea00f3dd
52 changed files with 1100 additions and 334 deletions

View File

@ -1,31 +0,0 @@
package errdefs
import "errors"
type internalErr struct {
error
}
func (internalErr) System() {}
func (err internalErr) Unwrap() error {
return err.error
}
type system interface {
System()
}
var _ system = internalErr{}
func Internal(err error) error {
if err == nil {
return nil
}
return internalErr{err}
}
func IsInternal(err error) bool {
var s system
return errors.As(err, &s)
}

59
vendor/github.com/moby/buildkit/errdefs/internal.go generated vendored Normal file
View File

@ -0,0 +1,59 @@
package errdefs
import (
"errors"
"syscall"
)
type internalErr struct {
error
}
func (internalErr) System() {}
func (err internalErr) Unwrap() error {
return err.error
}
type system interface {
System()
}
var _ system = internalErr{}
func Internal(err error) error {
if err == nil {
return nil
}
return internalErr{err}
}
func IsInternal(err error) bool {
var s system
if errors.As(err, &s) {
return true
}
var errno syscall.Errno
if errors.As(err, &errno) {
if _, ok := isInternalSyscall(errno); ok {
return true
}
}
return false
}
func IsResourceExhausted(err error) bool {
var errno syscall.Errno
if errors.As(err, &errno) {
if v, ok := isInternalSyscall(errno); ok && v {
return v
}
}
return false
}
func isInternalSyscall(err syscall.Errno) (bool, bool) {
v, ok := syscallErrors()[err]
return v, ok
}

View File

@ -0,0 +1,23 @@
//go:build linux
// +build linux
package errdefs
import (
"syscall"
"golang.org/x/sys/unix"
)
// syscallErrors returns a map of syscall errors that are considered internal.
// value is true if the error is of type resource exhaustion, false otherwise.
func syscallErrors() map[syscall.Errno]bool {
return map[syscall.Errno]bool{
unix.EIO: false, // I/O error
unix.ENOMEM: true, // Out of memory
unix.EFAULT: false, // Bad address
unix.ENOSPC: true, // No space left on device
unix.ENOTRECOVERABLE: false, // State not recoverable
unix.EHWPOISON: false, // Memory page has hardware error
}
}

View File

@ -0,0 +1,10 @@
//go:build !linux
// +build !linux
package errdefs
import "syscall"
func syscallErrors() map[syscall.Errno]bool {
return nil
}