From c5a0d87ab075358affde80dba81ee168e74ed03b Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Thu, 5 Sep 2024 11:06:21 +0200 Subject: [PATCH] Shorten icingadb/v1.EnvironmentFromContext() --- pkg/icingadb/v1/environment.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pkg/icingadb/v1/environment.go b/pkg/icingadb/v1/environment.go index 6b35d5c4b..ae3270449 100644 --- a/pkg/icingadb/v1/environment.go +++ b/pkg/icingadb/v1/environment.go @@ -27,11 +27,8 @@ func (e *Environment) Meta() *EnvironmentMeta { // // Error handling. // } func EnvironmentFromContext(ctx context.Context) (*Environment, bool) { - if e, ok := ctx.Value(environmentContextKey).(*Environment); ok { - return e, true - } - - return nil, false + e, ok := ctx.Value(environmentContextKey).(*Environment) + return e, ok } // environmentContextKey is the key for Environment values in contexts.