-
Notifications
You must be signed in to change notification settings - Fork 8
Conversation
This should probably get a test. |
@Stebalien didn't think it would add much value, since the function just creates a struct, but I pushed it in 1edd98c. Couldn't think of a way other than creating a mock host, or importing another module (which we don't want to do). LGTY? |
Alternatively we could have an interface that's a partial view on Host with only |
Oh, nevermind. I'm just working on a knee-jerk needs-test reaction. The test is more likely to break than the code. |
@Stebalien I feel you; I'll rm this test. |
Why does this new function return a The API seems quite inconsistent, here. Am I missing something? |
@lthibault for consistency with We do return a concrete |
Are you using the term "concrete" to mean "not an interface"? If so, this is just semantics :) More to the point, shouldn't |
@lthibault it could, but i don't really see the value. Pointers don't make an API feel inconsistent; they're used for technical reasons. The actual types are the same. That said, these structs are small enough that copy-on-return wouldn't hurt. But this change is not worth the breakage. |
Yeah, in most places we try to return these by value but it's really not that much of an issue (and I agree with being consistent). |
Trivial change to make this easier based on user feedback.
go-libp2p-host already imports the go-libp2p-peerstore, so no strings attached.