Goで構造体フィールド初期化漏れを検出する
golangci-lint に exhaustruct がある。これを実行するとエラーが出力される。
$ golangci-lint run --disable-all --enable=exhaustructlist.go:186:11: kinesis.PutRecordsInput is missing field StreamARN (exhaustruct) input = &kinesis.PutRecordsInput{ ^reader.go:129:12: pb.Message is missing fields Series, Error (exhaustruct) items := &pb.Message{} ^便利なんだけど、上記の出力でいえば &pb.Message{} のように意図的な省略をしている場合には邪魔かもしれない。exhaustructは型リテラルごとにデフォルトの挙動と個別の挙動を変えられるので、こういった場合は exhaustruct:ignore するといい。
Goでenumの記述漏れを検出するとかGoでinterfaceのtype switchに記述漏れがあったら検出するもある。