代码拉取完成,页面将自动刷新
package tracer
import "context"
var key keyType
var debugKey debugKeyType
type keyType struct{}
type debugKeyType struct{}
func Get(ctx context.Context) *Tracer {
if ctx != nil {
if v := ctx.Value(key); v != nil {
if t, ok := v.(*Tracer); ok {
return t
}
}
}
return nil
}
func IsDebug(ctx context.Context) bool {
if ctx == nil {
return false
}
v := ctx.Value(debugKey)
b, _ := v.(bool)
return b
}
func SetDebug(ctx context.Context) context.Context {
if ctx != nil {
ctx = context.WithValue(ctx, debugKey, true)
}
return ctx
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。