Ian Lance Taylor
unread,Sep 19, 2014, 10:37:04 AM9/19/14Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to chai2010, Dan Kortschak, Jan Mercl, Islan Dberry, golang-nuts
On Thu, Sep 18, 2014 at 8:23 PM, chai2010 <
chais...@gmail.com> wrote:
>
> The `testing.TB` is not a really private interface,
> We can implementing the `testing.TB` interface.
> Just like `TB.Fatal`.
The point is that if you do that, and we then add methods to
testing.TB, your code will not break.
If we did not have the private method, then you could write your own
type with your own methods that implemented everything in testing.TB,
and you could use your type, but then when we added methods to
testing.TB, your code would break.
In other words, exactly what the comment says:
// A private method to prevent users implementing the
// interface and so future additions to it will not
// violate Go 1 compatibility.
Ian