15 lines
280 B
Go
15 lines
280 B
Go
package platformscope
|
|
|
|
import "context"
|
|
|
|
type contextKey struct{}
|
|
|
|
func WithScope(ctx context.Context) context.Context {
|
|
return context.WithValue(ctx, contextKey{}, true)
|
|
}
|
|
|
|
func IsScope(ctx context.Context) bool {
|
|
enabled, _ := ctx.Value(contextKey{}).(bool)
|
|
return enabled
|
|
}
|