Files
v2fly/common/environment/envctx/env.go
T
LoyalsoldierandGitHub 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)
}