Goでよく使うインターフェイス
This content is a draft and will not be included in production builds.
fmt.Stringer
Section titled “fmt.Stringer”fmt.Formatter
Section titled “fmt.Formatter”io.Reader, io.Writer
Section titled “io.Reader, io.Writer”io.ReaderFrom, io.WriterTo
Section titled “io.ReaderFrom, io.WriterTo”json.Marshaler, json.Unmarshaler
Section titled “json.Marshaler, json.Unmarshaler”encoding.BinaryMarshaler, encoding.TextMarshaler
Section titled “encoding.BinaryMarshaler, encoding.TextMarshaler”Encoder, Decoder, Codec
Section titled “Encoder, Decoder, Codec”transform.Transformer
Section titled “transform.Transformer”標準ライブラリでは、Encoder や Decoder は構造体として定義されることが多い。
NewXxx 関数は(あまり)エラーを返さない。Go 1.23からざっと数えたところ、全体で約500個のうちエラーを返すものは約60個程度だった。
文字列やバイト列を受け取って型を変換するものは ParseXxx と表現されることが多い。