Skip to content

Commit

Permalink
build(deps): bump github.com/gontainer/reflectpro (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
bkrukowski committed Mar 5, 2024
1 parent 8b33ad3 commit 16d6d2b
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 19 deletions.
9 changes: 0 additions & 9 deletions caller/caller.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,9 @@ var (
// Deprecated: use [caller.CallProviderMethod].
CallProviderMethod = caller.CallProviderMethod

// Deprecated: use [caller.ForceCallProviderMethod].
ForceCallProviderMethod = caller.ForceCallProviderMethod

// Deprecated: use [caller.CallMethod].
CallMethod = caller.CallMethod

// Deprecated: use [caller.ForceCallMethod].
ForceCallMethod = caller.ForceCallMethod

// Deprecated: [caller.CallWither].
CallWither = caller.CallWither

// Deprecated: [caller.ForceCallWither].
ForceCallWither = caller.ForceCallWither
)
3 changes: 2 additions & 1 deletion container/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ func (c *Container) resolveDep(ctx context.Context, contextualBag keyValue, d De
case dependencyParam:
return c.getParam(d.paramID)
case dependencyProvider:
return caller.CallProvider(d.provider, nil, convertArgs)
r, _, err := caller.CallProvider(d.provider, nil, convertArgs)
return r, err
case dependencyContainer:
return c, nil
case dependencyContext:
Expand Down
10 changes: 5 additions & 5 deletions container/container_services.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func (c *Container) createNewService(ctx context.Context, svc Service, contextua
if err != nil {
return nil, grouperror.Prefix("constructor args: ", err)
}
result, err = caller.CallProvider(svc.constructor, args, convertArgs)
result, _, err = caller.CallProvider(svc.constructor, args, convertArgs)
if err != nil {
return nil, grouperror.Prefix("constructor: ", err)
}
Expand All @@ -212,7 +212,7 @@ func (c *Container) createNewService(ctx context.Context, svc Service, contextua
if err != nil {
return nil, grouperror.Prefix("factory args: ", err)
}
result, err = caller.ForceCallProviderMethod(obj, svc.factoryMethod, args, convertArgs)
result, _, err = caller.CallProviderMethod(obj, svc.factoryMethod, args, convertArgs)
if err != nil {
return nil, grouperror.Prefix(fmt.Sprintf("factory @%s.%s: ", svc.factoryServiceID, svc.factoryMethod), err)
}
Expand Down Expand Up @@ -263,15 +263,15 @@ func (c *Container) executeServiceCalls(
}

if call.wither {
result, err = caller.ForceCallWither(&result, call.method, args, convertArgs)
result, err = caller.CallWither(&result, call.method, args, convertArgs)
if err != nil {
errs = append(errs, grouperror.Prefix(fmt.Sprintf("%s %+q: ", action, call.method), err))
// wither may return a nil value for error,
// so we have to stop execution here
break
}
} else {
_, err = caller.ForceCallMethod(&result, call.method, args, convertArgs)
_, err = caller.CallMethod(&result, call.method, args, convertArgs)
if err != nil {
errs = append(errs, grouperror.Prefix(fmt.Sprintf("%s %+q: ", action, call.method), err))
}
Expand Down Expand Up @@ -304,7 +304,7 @@ func (c *Container) decorateService(
return nil, grouperror.Prefix(fmt.Sprintf("resolve decorator args #%d: ", i), err)
}
args = append([]any{payload}, args...)
result, err = caller.CallProvider(dec.fn, args, convertArgs)
result, _, err = caller.CallProvider(dec.fn, args, convertArgs)
if err != nil {
return nil, grouperror.Prefix(fmt.Sprintf("decorator #%d: ", i), err)
}
Expand Down
6 changes: 3 additions & 3 deletions container/container_services_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ func TestContainer_executeServiceCalls(t *testing.T) {

expected := []string{
`get("service"): resolve args "SetName": arg #0: provider returned error: could not fetch the name from the config`,
`get("service"): call "SetAge": cannot call method (*interface {})."SetAge": invalid func (*struct {})."SetAge"`,
`get("service"): call "SetColor": cannot call method (*interface {})."SetColor": invalid func (*struct {})."SetColor"`,
`get("service"): wither "WithLogger": cannot call wither (*interface {})."WithLogger": invalid func (*struct {})."WithLogger"`,
`get("service"): call "SetAge": cannot call method (*interface {})."SetAge": (*struct {})."SetAge": invalid method`,
`get("service"): call "SetColor": cannot call method (*interface {})."SetColor": (*struct {})."SetColor": invalid method`,
`get("service"): wither "WithLogger": cannot call wither (*interface {})."WithLogger": cannot call method (*interface {})."WithLogger": (*struct {})."WithLogger": invalid method`,
}

svc, err := c.Get("service")
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/gontainer/exporter v1.0.1
github.com/gontainer/graph v1.0.0
github.com/gontainer/grouperror v1.0.1
github.com/gontainer/reflectpro v0.0.0-20240303103625-cd0a20882e59
github.com/gontainer/reflectpro v0.0.0-20240305193905-371323a8dfaf
)

require ( // tests
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ github.com/gontainer/grouperror v1.0.1 h1:hNWVEIQZrt3e1q2YBprPEGDN2nYlkE2Px5igj/
github.com/gontainer/grouperror v1.0.1/go.mod h1:6/EHrISoPeYWcnzKx0JUxlSI34nMOMaLihNg6VnWDPc=
github.com/gontainer/reflectpro v0.0.0-20240303103625-cd0a20882e59 h1:MwvCwO3IfcWfKAUTcXIWz+jpGUQsUrY9sAFo98sfU74=
github.com/gontainer/reflectpro v0.0.0-20240303103625-cd0a20882e59/go.mod h1:lJHUIw9ALry6ofwOoQ04OwTchWGoTU0uwN8w2VCKAm4=
github.com/gontainer/reflectpro v0.0.0-20240305193905-371323a8dfaf h1:7gdcN5zBTze4NCO1WjKJQuCPRORp5ict5+jVyEHpeX4=
github.com/gontainer/reflectpro v0.0.0-20240305193905-371323a8dfaf/go.mod h1:eGV+xNkh0jVTH+XHbv85lpQLXOrB67XSf5wiNPB0VkU=
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/jung-kurt/gofpdf v1.0.0/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes=
github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes=
Expand Down

0 comments on commit 16d6d2b

Please sign in to comment.