Skip to content

Commit

Permalink
lintcmd: remove binaryOutput type
Browse files Browse the repository at this point in the history
We can just encode LintResult directly
  • Loading branch information
dominikh committed Nov 20, 2021
1 parent 1619e48 commit fda607d
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions lintcmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit fda607d

Please sign in to comment.