1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-09-27 06:16:09 -04:00
v2fly/common/environment/envctx/env.go
Loyalsoldier dce8764fd7
Lint: fix lint (#1427)
* Lint: replace golint with revive
* Lint: fix lint
2021-11-27 17:16:41 +08:00

18 lines
376 B
Go

package envctx
import "context"
type environmentContextKey int
const (
environmentKey environmentContextKey = iota
)
func ContextWithEnvironment(ctx context.Context, environment interface{}) context.Context {
return context.WithValue(ctx, environmentKey, environment)
}
func EnvironmentFromContext(ctx context.Context) interface{} {
return ctx.Value(environmentKey)
}