Fx.Annotate may panic with a constructor that returns a non-nil error
sywhang opened this issue · 0 comments
sywhang commented
Given the following annotation:
fx.Provide(fx.Annotate(func() (*bytes.Buffer, error) {
buf := make([]byte, 1)
return bytes.NewBuffer(buf), errors.New("some error")
}, fx.ResultTags(`name:"buf"`)))
The reflection done to make a new return type will panic with the following error:
panic: reflect.MakeFunc: value of type errors.errorString is not assignable to type error [recovered]
panic: reflect.MakeFunc: value of type errors.errorString is not assignable to type error