-
Notifications
You must be signed in to change notification settings - Fork 610
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
Better error messages #334
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe.
It's a go convention not to start a variable name in a package with the package name, which means that
config
should exportconfig.Provider
notconfig.ConfigProvider
. However, wire doesn't include the package name in error messages which forces us to name providerspackage.PackageProvider
for error visibility.When combined with other generation tools (e.g. proto3), sometimes interfaces are renamed or moved during code generation. The wire error message just refers to the missing interface as
invalid type
, which is not very useful for debugging.Describe the solution you'd like
Error messages referring to a provider should contain the full variable path including the package name (e.g.
config.Provider
instead of justProvider
)Error messages referring to an invalid type should include the raw text name of that type.
Example:
Current error:
Improved error:
Describe alternatives you've considered
For the first problem, the alternative is to include package names in the provider var name as per the example. For the second problem, there are no alternatives to wire printing the interface name.
The text was updated successfully, but these errors were encountered: