From 4c8b39e70a0e5f7235a53e6d38aaf31f34e990ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Jochum?= Date: Sun, 25 Sep 2022 09:58:06 +0200 Subject: [PATCH] Remove registry from context retrieving, registry is no more in the context --- registry.go | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/registry.go b/registry.go index eabf86b..bf1f6c4 100644 --- a/registry.go +++ b/registry.go @@ -9,11 +9,6 @@ import ( "go-micro.dev/v4/errors" ) -var ( - errorRetrievingComponents = errors.InternalServerError("RETRIEVING_COMPONENTS", "error while retrieving components") - errorComponentsIsNil = errors.InternalServerError("COMPONENTS_NIL", "components is nil") -) - type HealthInfo struct { Message string `json:"message"` IsError bool `json:"is_error"` @@ -21,8 +16,6 @@ type HealthInfo struct { type HealthInfoMap map[string]HealthInfo -type RegistryKey struct{} - type Registry struct { components map[string]Component @@ -30,28 +23,6 @@ type Registry struct { flagPrefix string } -func Context(ctx context.Context) (*Registry, error) { - c, ok := ctx.Value(RegistryKey{}).(*Registry) - if !ok { - return nil, errorRetrievingComponents - } - - if c == nil { - return nil, errorComponentsIsNil - } - - return c, nil -} - -func Must(ctx context.Context) *Registry { - c, err := Context(ctx) - if err != nil { - panic(err) - } - - return c -} - func New(service micro.Service, flagPrefix string, components ...Component) *Registry { com := &Registry{service: service, flagPrefix: flagPrefix, components: make(map[string]Component)}