mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
vendor: update buildkit to f238f1e
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
27
vendor/golang.org/x/net/trace/trace.go
generated
vendored
27
vendor/golang.org/x/net/trace/trace.go
generated
vendored
@ -64,6 +64,7 @@ package trace // import "golang.org/x/net/trace"
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"io"
|
||||
@ -85,6 +86,12 @@ import (
|
||||
// FOR DEBUGGING ONLY. This will slow down the program.
|
||||
var DebugUseAfterFinish = false
|
||||
|
||||
// HTTP ServeMux paths.
|
||||
const (
|
||||
debugRequestsPath = "/debug/requests"
|
||||
debugEventsPath = "/debug/events"
|
||||
)
|
||||
|
||||
// AuthRequest determines whether a specific request is permitted to load the
|
||||
// /debug/requests or /debug/events pages.
|
||||
//
|
||||
@ -111,8 +118,8 @@ var AuthRequest = func(req *http.Request) (any, sensitive bool) {
|
||||
}
|
||||
|
||||
func init() {
|
||||
_, pat := http.DefaultServeMux.Handler(&http.Request{URL: &url.URL{Path: "/debug/requests"}})
|
||||
if pat != "" {
|
||||
_, pat := http.DefaultServeMux.Handler(&http.Request{URL: &url.URL{Path: debugRequestsPath}})
|
||||
if pat == debugRequestsPath {
|
||||
panic("/debug/requests is already registered. You may have two independent copies of " +
|
||||
"golang.org/x/net/trace in your binary, trying to maintain separate state. This may " +
|
||||
"involve a vendored copy of golang.org/x/net/trace.")
|
||||
@ -120,8 +127,20 @@ func init() {
|
||||
|
||||
// TODO(jbd): Serve Traces from /debug/traces in the future?
|
||||
// There is no requirement for a request to be present to have traces.
|
||||
http.HandleFunc("/debug/requests", Traces)
|
||||
http.HandleFunc("/debug/events", Events)
|
||||
http.HandleFunc(debugRequestsPath, Traces)
|
||||
http.HandleFunc(debugEventsPath, Events)
|
||||
}
|
||||
|
||||
// NewContext returns a copy of the parent context
|
||||
// and associates it with a Trace.
|
||||
func NewContext(ctx context.Context, tr Trace) context.Context {
|
||||
return context.WithValue(ctx, contextKey, tr)
|
||||
}
|
||||
|
||||
// FromContext returns the Trace bound to the context, if any.
|
||||
func FromContext(ctx context.Context) (tr Trace, ok bool) {
|
||||
tr, ok = ctx.Value(contextKey).(Trace)
|
||||
return
|
||||
}
|
||||
|
||||
// Traces responds with traces from the program.
|
||||
|
Reference in New Issue
Block a user