Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider adding version qualifiers to debug messages #56

Closed
raceline-dev opened this issue Feb 1, 2023 · 2 comments · Fixed by #57
Closed

Consider adding version qualifiers to debug messages #56

raceline-dev opened this issue Feb 1, 2023 · 2 comments · Fixed by #57

Comments

@raceline-dev
Copy link

Injection failed with this message:

        	Error:      	Received unexpected error:
        	            	final-func: user-chain(2) [func(context.Context, public.Resolver)]: required but no provider for public.Resolver in inputs (not provided by injector: integration-before-user(5) [func(*pkg.Client) public.Resolver] because has no match for its input parameter *pkg.Client)

There was in fact a pkg.Client available, but the injector listed above was expecting a pkg/v2.Client, not a pkg.Client.

This was confusing to debug. It would be nice if types included a version indicator for non-v1 pakages. Or is this a more general problem with resolving package aliases in general?

@muir
Copy link
Owner

muir commented Feb 1, 2023

Unfortunately, the Go reflect package doesn't help much here.

For a direct type, I can solve it. For a pointer, slice, etc, I'm not sure how.

Here's the relevant bit of documentation from the reflect package:

// PkgPath returns a defined type's package path, that is, the import path
// that uniquely identifies the package, such as "encoding/base64".
// If the type was predeclared (string, error) or not defined (*T, struct{},
// []int, or A where A is an alias for a non-defined type), the package path
// will be the empty string.
PkgPath() string

So, I could change pkg.Client to pkg/v2.Client, but I cannot change *pkg.Client :(

In the case of a failure, I can, perhaps walk through all seen types and see if there are any that have the same name and include that in the failure message. That might provide a hint of that there is a problem, but it could be overlooked.

@muir
Copy link
Owner

muir commented Feb 2, 2023

I decided I could do better. See muir/reflectutils#12 and #58

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants