From fda607db56dd2cee7078ea0d7390faa3ed5e17fd Mon Sep 17 00:00:00 2001 From: Dominik Honnef Date: Sat, 20 Nov 2021 17:47:35 +0100 Subject: [PATCH] lintcmd: remove binaryOutput type We can just encode LintResult directly --- lintcmd/cmd.go | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/lintcmd/cmd.go b/lintcmd/cmd.go index 16dc4fd7d..d5ced2496 100644 --- a/lintcmd/cmd.go +++ b/lintcmd/cmd.go @@ -29,11 +29,6 @@ import ( "golang.org/x/tools/go/buildutil" ) -type binaryOutput struct { - CheckedFiles []string - Diagnostics []diagnostic -} - // Command represents a linter command line tool. type Command struct { name string @@ -220,8 +215,8 @@ type run struct { func decodeGob(br io.ByteReader) ([]run, error) { var runs []run for { - var bin binaryOutput - if err := gob.NewDecoder(br.(io.Reader)).Decode(&bin); err != nil { + var res LintResult + if err := gob.NewDecoder(br.(io.Reader)).Decode(&res); err != nil { if err == io.EOF { break } else { @@ -397,11 +392,7 @@ func (cmd *Command) Run() { } if cmd.flags.formatter == "binary" { - bin := binaryOutput{ - CheckedFiles: res.CheckedFiles, - Diagnostics: res.Diagnostics, - } - err := gob.NewEncoder(os.Stdout).Encode(bin) + err := gob.NewEncoder(os.Stdout).Encode(res) if err != nil { fmt.Fprintf(os.Stderr, "failed writing output: %s\n", err) cmd.exit(2)