Go Package io: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 7: Line 7:


* [[Go_Language_Modularization#io|Standard Library]]
* [[Go_Language_Modularization#io|Standard Library]]
* [[File Operations in Go#Overview|File Operations in Go]]


=Overview=
=Overview=

Revision as of 23:55, 18 December 2023

External

Internal

Overview

The io package consists of a few functions, but mostly interfaces used by other packages.

Reader

https://golang.org/pkg/io/#Reader

An interface that exposes Read().

Readers can be used to unmarshall JSON into structs as shown here:

Unmarshalling JSON from a Reader into a struct

Writer

https://golang.org/pkg/io/#Writer

ReadCloser

An interface that exposes basic Read() and Close() methods. The http.Request body is a ReadCloser. See Reader.