0xf

日記だよ

2022-11-28から1日間の記事一覧

当たり前だがfmt.Printlnもエラーになることがある

bytes, err := fmt.Println("hoge") ... 戻り値は It returns the number of bytes written and any write error encountered. とされている。なるほど。Scanfとかはバイト数を返すのは違和感がない。だったら書き込む方も同様として違和感はない。そうです…

VSCodeのテストのスケルトン生成は単純に便利だった

func Min(x, y int) int { if x < y { return x } return y } こういう簡単なコードに対してテストコードの生成を行うと以下のようなコードが生成される。 func TestMin(t *testing.T) { type args struct { x int y int } tests := []struct { name string …