From ccbb57fb488b535c2faa8ccb40559319253e7b9e Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Thu, 8 Nov 2018 03:28:33 +0000 Subject: [PATCH] trace: remove Go 1.6 support Change-Id: I07355ffab9e0e9437dc43cb99670736fe65bc25a Reviewed-on: https://go-review.googlesource.com/c/148437 Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot Reviewed-by: Dmitri Shuralyov --- trace/trace.go | 13 +++++++++++++ trace/trace_go16.go | 21 --------------------- trace/trace_go17.go | 21 --------------------- 3 files changed, 13 insertions(+), 42 deletions(-) delete mode 100644 trace/trace_go16.go delete mode 100644 trace/trace_go17.go diff --git a/trace/trace.go b/trace/trace.go index f00d869f..43711c67 100644 --- a/trace/trace.go +++ b/trace/trace.go @@ -64,6 +64,7 @@ package trace // import "golang.org/x/net/trace" import ( "bytes" + "context" "fmt" "html/template" "io" @@ -124,6 +125,18 @@ func init() { http.HandleFunc("/debug/events", 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. // The package initialization registers it in http.DefaultServeMux // at /debug/requests. diff --git a/trace/trace_go16.go b/trace/trace_go16.go deleted file mode 100644 index d6081911..00000000 --- a/trace/trace_go16.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !go1.7 - -package trace - -import "golang.org/x/net/context" - -// 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 -} diff --git a/trace/trace_go17.go b/trace/trace_go17.go deleted file mode 100644 index df6e1fba..00000000 --- a/trace/trace_go17.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build go1.7 - -package trace - -import "context" - -// 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 -}