Y
Hacker News
new
|
ask
|
show
|
jobs
by
enneff
4721 days ago
Yes, easily:
var rc io.ReadCloser // a file, whatever readerOnly := struct{io.Reader}{rc} // only a Reader
1 comments
frou_dh
4721 days ago
That's cool. The io.Reader is an unnamed field, so its method is effectively pushed to the surface of the wrapping struct instead of needing to be explicitly forwarded to.
link