Merged
Conversation
TheJakeSchmidt
approved these changes
Mar 3, 2017
| } | ||
| if len(impls) > 1 && i.options.PanicOnAmbiguity { | ||
| panic(fmt.Sprintf("Expect single matching implementation but found %v", len(impls))) | ||
| panic(fmt.Sprintf("Expected single matching implementation for type <%v> but found %v: %v", t, len(impls), impls)) |
There was a problem hiding this comment.
Does reflect.Value stringify nicely for all types? The documentation for reflect.Value's String() method (https://golang.org/pkg/reflect/#Value.String) says "The fmt package treats Values specially. It does not call their String method implicitly but instead prints the concrete values they hold.", but your test seems to indicate it prints the type, so I don't know what to believe anymore.
Author
There was a problem hiding this comment.
Hmm not sure why fmt package is not doing what it says, but from what I see, Value is printed as where T is v's type. So that suggests fmt package is calling String() method?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Print out the name of the requested type, and the ambiguous implementations when panicking. This will be helpful for debugging.