vendor: update buildkit to v0.8

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi
2020-12-07 22:01:24 -08:00
parent 080e9981c7
commit 69a1419ab1
323 changed files with 20129 additions and 8394 deletions

View File

@ -4,15 +4,22 @@ import (
"fmt"
io "io"
"os"
"runtime"
"strconv"
"strings"
"sync"
"github.com/containerd/typeurl"
"github.com/pkg/errors"
)
var helpers map[string]struct{}
var helpersMu sync.RWMutex
func init() {
typeurl.Register((*Stack)(nil), "github.com/moby/buildkit", "stack.Stack+json")
helpers = map[string]struct{}{}
}
var version string
@ -23,6 +30,19 @@ func SetVersionInfo(v, r string) {
revision = r
}
func Helper() {
var pc [1]uintptr
n := runtime.Callers(2, pc[:])
if n == 0 {
return
}
frames := runtime.CallersFrames(pc[:n])
frame, _ := frames.Next()
helpersMu.Lock()
helpers[frame.Function] = struct{}{}
helpersMu.Unlock()
}
func Traces(err error) []*Stack {
var st []*Stack
@ -52,6 +72,7 @@ func Enable(err error) error {
if err == nil {
return nil
}
Helper()
if !hasLocalStackTrace(err) {
return errors.WithStack(err)
}
@ -112,6 +133,8 @@ func (w *formatter) Format(s fmt.State, verb rune) {
func convertStack(s errors.StackTrace) *Stack {
var out Stack
helpersMu.RLock()
defer helpersMu.RUnlock()
for _, f := range s {
dt, err := f.MarshalText()
if err != nil {
@ -121,6 +144,9 @@ func convertStack(s errors.StackTrace) *Stack {
if len(p) != 2 {
continue
}
if _, ok := helpers[p[0]]; ok {
continue
}
idx := strings.LastIndexByte(p[1], ':')
if idx == -1 {
continue