[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" grou

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 no

[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 re