[go-nuts] Why isn't os.File an interface?

2018-04-09 Thread Dave Cheney
Please have a read of my talk on solid from 2016. 

https://dave.cheney.net/2016/08/20/solid-go-design

Tldr: define an interface with the behaviour of the os.File that your 
function/method expects. 

-- 
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.


Re: [go-nuts] Why isn't os.File an interface?

2018-04-09 Thread Paul Jolly
See https://github.com/golang/go/issues/14106

On 9 April 2018 at 19:40, Glen Newton  wrote:

> Hello,
>
> I was wondering why os.File is a struct and not an interface. It does not
> expose anything except methods.
>
> I was wanting to make a mock os.File for testing and other purposes, but
> it not being an interface makes this not easy. Unless I am missing
> something here.
>
> Thanks,
> Glen
>
> --
> 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.
>

-- 
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.


[go-nuts] Why isn't os.File an interface?

2018-04-09 Thread Glen Newton
Hello,

I was wondering why os.File is a struct and not an interface. It does not 
expose anything except methods.

I was wanting to make a mock os.File for testing and other purposes, but it 
not being an interface makes this not easy. Unless I am missing something 
here.

Thanks,
Glen

-- 
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.