MockPackage()
John Meinel
john at arbash-meinel.com
Tue Mar 4 12:30:30 UTC 2014
honestly, http.DefaultClient is a case of global state that too many
people touch, and I'd be happier to avoid them.
On Tue, Mar 4, 2014 at 1:58 PM, roger peppe <rogpeppe at gmail.com> wrote:
> On 3 March 2014 17:49, Nate Finch <nate.finch at canonical.com> wrote:
>> John talked to me on a hangout and suggested that, often times, when you
>> need to expose something like this for tests, it ends up being something
>> that production code needs to tweak as well. He'd like to see something
>> better than a public variable, but didn't offer a suggestion as to what.
>>
>> I think this is a pretty good point, so I'll try to come up with a third way
>> that isn't too cumbersome.
>
> I think a public variable is actually OK. We don't actually have to stipulate
> that it should only be changed for testing, and the global nature of
> should make it clear that it should not be changed other than at init time.
>
> It's a pretty standard Go idiom to do this (see http.DefaultClient,
> for example).
>
> --
> Juju-dev mailing list
> Juju-dev at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/juju-dev
More information about the Juju-dev
mailing list