Skip to content

Commit

Permalink
Shorten icingadb/v1.EnvironmentFromContext()
Browse files Browse the repository at this point in the history
  • Loading branch information
Al2Klimov committed Sep 5, 2024
1 parent 277a61d commit c5a0d87
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions pkg/icingadb/v1/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit c5a0d87

Please sign in to comment.