readwriteseekcloser.go (608B)
1 package rifs 2 3 import ( 4 "io" 5 ) 6 7 // ReadWriteSeekCloser satisfies `io.ReadWriteSeeker` and `io.Closer` 8 // interfaces. 9 type ReadWriteSeekCloser interface { 10 io.ReadWriteSeeker 11 io.Closer 12 } 13 14 type readWriteSeekNoopCloser struct { 15 io.ReadWriteSeeker 16 } 17 18 // ReadWriteSeekNoopCloser wraps a `io.ReadWriteSeeker` with a no-op Close() 19 // call. 20 func ReadWriteSeekNoopCloser(rws io.ReadWriteSeeker) ReadWriteSeekCloser { 21 return readWriteSeekNoopCloser{ 22 ReadWriteSeeker: rws, 23 } 24 } 25 26 // Close does nothing but allows the RWS to satisfy `io.Closer`.:wq 27 func (readWriteSeekNoopCloser) Close() (err error) { 28 return nil 29 }