Goならわかるシステムプログラミング

いったん読んだ。とはいえサクッと読める本ではなく、リファレンス的につかいながら何度も固めるべき内容。

内容は、ASCII.jp:Goならわかるシステムプログラミングを加筆したもの。なんとなく理解して動かしていたものが、プログラマになった経験をある程度積んだ今これを読んだおかげて、少しづつつながってきている感じがある。

例えば、fmt.Println()は、io.Writerを第一引数に取るFprintln(w io.Writer, a ...interface{}) (n int, err error)を内部的に呼んで標準出力に出しているんだー、とか。

// These routines end in 'ln', do not take a format string,
// always add spaces between operands, and add a newline
// after the last operand.

// Fprintln formats using the default formats for its operands and writes to w.
// Spaces are always added between operands and a newline is appended.
// It returns the number of bytes written and any write error encountered.
func Fprintln(w io.Writer, a ...interface{}) (n int, err error) {  
    p := newPrinter()
    p.doPrintln(a)
    n, err = w.Write(p.buf)
    p.free()
    return
}