On Wed, 17 Oct 2018 at 17:30, Kyle Butz <kyleb...@gmail.com> wrote: > It looks like transport() is returning a RoundTripper by value. Does that > mean that "return DefaultTransport" returns a new copy of DefaultTransport, > or just a copy of a pointer to the global DefaultTransport defined in > transport.go? >
You might find this interesting reading to help build up a mental model: https://research.swtch.com/interfaces Another thing to mention, you don't often see pointers-to-interfaces, most interfaces are passed around by-value. Remember that "an interface value is internally a tuple of (type, pointer-to-data)", so copying an interface really copies a pointer around. Things get a bit more mind bending when you store a value in an interface. There is still a pointer-to-data in there, but now whenever you access the value you get a copy of the data out. This is why you can't then call methods-with-pointer-receivers when you put a value into an interface. At least, as I understand it :) -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.