# io interface

Published articles for io interface.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Interfaces 101 : Interface Type Assertion Ep. 6

DevFeed: [Interfaces 101 : Interface Type Assertion Ep. 6](<https://devfeed.tech/articles/interfaces-101-interface-type-assertion-ep-6-22218.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2023/03/interfaces-101-interface-type-assertions.html>)

Published: 2023-03-07T00:00:00Z

Content type: tutorial

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

Topics: [interfaces](<https://devfeed.tech/topics/interfaces.md>), [Go Language](<https://devfeed.tech/topics/go-language.md>), [IO](<https://devfeed.tech/topics/io.md>), [Streams](<https://devfeed.tech/topics/streams.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [copy](<https://devfeed.tech/tags/copy.md>), [flush](<https://devfeed.tech/tags/flush.md>), [go](<https://devfeed.tech/tags/go.md>), [golang](<https://devfeed.tech/tags/golang.md>), [interfaces](<https://devfeed.tech/tags/interfaces.md>), [introduction](<https://devfeed.tech/tags/introduction.md>), [io](<https://devfeed.tech/tags/io.md>), [io-interface](<https://devfeed.tech/tags/io-interface.md>), [io-reader](<https://devfeed.tech/tags/io-reader.md>), [io-writer](<https://devfeed.tech/tags/io-writer.md>), [library](<https://devfeed.tech/tags/library.md>), [logger](<https://devfeed.tech/tags/logger.md>), [receiver](<https://devfeed.tech/tags/receiver.md>), [type-alias](<https://devfeed.tech/tags/type-alias.md>), [versatile](<https://devfeed.tech/tags/versatile.md>), [video](<https://devfeed.tech/tags/video.md>)

### AI overview

This video tutorial explains how to use type assertions and Go interfaces. It demonstrates io.Reader and io.Writer, io.Copy, and interface design while building a logging library that moves data from memory to stable storage.

### Source excerpt

Introduction In episode 5, Miki wrote a function that counted the number of lines in a file with interfaces. The first thing his function did was to open a file with Go's os.Open function. Miki chose this method because the variable returned by said function implements the io.Reader interface which is crucial for the next step. The remaining parts of this function consisted of a primitive type alias that satisfied the io.Writer interface and tracked the number of lines by increasing the Write method's receiver value. To put the process in motion, Miki will invoke function io.Copy to trigger his type alias' Write method and in essence, count the number of lines in the file.