, Writer
, , Write
- , http.ResponseWriter
, , stdout os.Stdout
, struct.
io . , , , Reader
Writer
.
Go more, , Reader
Writer
, , :)
, ():
func (p *Person) WriteJson(w io.Writer) error {
b, err := json.Marshal(*p)
if err != nil {
return err
}
_, err = w.Write(b)
if err != nil {
return err
}
return err
}
, http Response, Stdout ; .
- , ; Person
:
, , Writer, , . > - , , . , , Write()
, .
, , ( ReadWriters
- , Error()
(ei. )).