From: Jochen Sprickerhof <jspricke@debian.org>
Date: Sun, 19 Sep 2021 09:50:04 +0200
Subject: Drop executable

---
 cmd/errorformat/.gitignore         |   1 -
 cmd/errorformat/main.go            | 167 -------------------------------------
 cmd/errorformat/main_test.go       | 129 ----------------------------
 cmd/errorformat/testdata/golint.in |   4 -
 cmd/errorformat/testdata/golint.sh |   2 -
 cmd/errorformat/testdata/grep.in   |   7 --
 cmd/errorformat/testdata/grep.sh   |   2 -
 cmd/errorformat/testdata/sbt.in    |  18 ----
 cmd/errorformat/testdata/sbt.sh    |   2 -
 9 files changed, 332 deletions(-)
 delete mode 100644 cmd/errorformat/.gitignore
 delete mode 100644 cmd/errorformat/main.go
 delete mode 100644 cmd/errorformat/main_test.go
 delete mode 100644 cmd/errorformat/testdata/golint.in
 delete mode 100644 cmd/errorformat/testdata/golint.sh
 delete mode 100644 cmd/errorformat/testdata/grep.in
 delete mode 100644 cmd/errorformat/testdata/grep.sh
 delete mode 100644 cmd/errorformat/testdata/sbt.in
 delete mode 100644 cmd/errorformat/testdata/sbt.sh

diff --git a/cmd/errorformat/.gitignore b/cmd/errorformat/.gitignore
deleted file mode 100644
index 95b99b8..0000000
--- a/cmd/errorformat/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-errorformat
diff --git a/cmd/errorformat/main.go b/cmd/errorformat/main.go
deleted file mode 100644
index 30db3dd..0000000
--- a/cmd/errorformat/main.go
+++ /dev/null
@@ -1,167 +0,0 @@
-package main
-
-import (
-	"flag"
-	"fmt"
-	"io"
-	"log"
-	"os"
-	"sort"
-	"strings"
-	"text/template"
-
-	"github.com/reviewdog/errorformat"
-	"github.com/reviewdog/errorformat/fmts"
-	"github.com/reviewdog/errorformat/writer"
-)
-
-const usageMessage = "" +
-	`Usage: errorformat [flags] [errorformat ...]
-
-errorformat reads compiler/linter/static analyzer result from STDIN, formats
-them by given 'errorformat' (90% compatible with Vim's errorformat. :h
-errorformat), and outputs formated result to STDOUT.
-
-Example:
-	$ echo '/path/to/file:14:28: error message\nfile2:3:4: msg' | errorformat "%f:%l:%c: %m"
-	/path/to/file|14 col 28| error message
-	file2|3 col 4| msg
-
-	$ golint ./... | errorformat -name=golint
-
-The -f flag specifies an alternate format for the entry, using the
-syntax of package template.  The default output is equivalent to -f
-'{{.String}}'. The struct being passed to the template is:
-
-	type Entry struct {
-		// name of a file
-		Filename string
-		// line number
-		Lnum int
-		// End of line number if the item is multiline
-		EndLnum int
-		// column number (first column is 1)
-		Col int
-		// End of column number if the item has range
-		EndCol int
-		// true: "col" is visual column
-		// false: "col" is byte index
-		Vcol bool
-		// error number
-		Nr int
-		// search pattern used to locate the error
-		Pattern string
-		// description of the error
-		Text string
-		// type of the error, 'E', '1', etc.
-		Type rune
-		// true: recognized error message
-		Valid bool
-
-		// -- Extensions (Go version only) --
-
-		// Original error lines (often one line. more than one line for multi-line
-		// errorformat. :h errorformat-multi-line)
-		Lines []string
-	}
-`
-
-func usage() {
-	fmt.Fprintln(os.Stderr, usageMessage)
-	fmt.Fprintln(os.Stderr, "Flags:")
-	flag.PrintDefaults()
-	os.Exit(2)
-}
-
-type option struct {
-	entryFmt  string
-	writerFmt string
-	name      string
-	list      bool
-}
-
-func main() {
-	opt := option{}
-	sarifOpt := writer.SarifOption{}
-	flag.StringVar(&opt.entryFmt, "f", "{{.String}}", "format template for -w=template")
-	flag.StringVar(&opt.writerFmt, "w", "template", "writer format (template|checkstyle|jsonl|sarif)")
-	flag.StringVar(&opt.name, "name", "", "defined errorformat name")
-	flag.BoolVar(&opt.list, "list", false, "list defined errorformats")
-	flag.StringVar(&sarifOpt.ToolName, "sarif.tool-name", "", "Tool name for Sarif writer format. Use -name flag if available.")
-	flag.Usage = usage
-	flag.Parse()
-	errorformats := flag.Args()
-	if err := run(os.Stdin, os.Stdout, errorformats, opt, sarifOpt); err != nil {
-		fmt.Fprintln(os.Stderr, err)
-		os.Exit(1)
-	}
-}
-
-func run(r io.Reader, w io.Writer, efms []string, opt option, sarifOpt writer.SarifOption) error {
-	if opt.list {
-		fs := fmts.DefinedFmts()
-		out := make([]string, 0, len(fs))
-		for _, f := range fs {
-			out = append(out, fmt.Sprintf("%s\t\t%s - %s", f.Name, f.Description, f.URL))
-		}
-		sort.Strings(out)
-		fmt.Fprintln(w, strings.Join(out, "\n"))
-		return nil
-	}
-
-	if opt.name != "" {
-		f, ok := fmts.DefinedFmts()[opt.name]
-		if !ok {
-			return fmt.Errorf("%q is not defined", opt.name)
-		}
-		efms = f.Errorformat
-		if sarifOpt.ToolName == "" {
-			sarifOpt.ToolName = opt.name
-		}
-	}
-
-	var ewriter writer.Writer
-
-	switch opt.writerFmt {
-	case "template", "":
-		fm := template.FuncMap{
-			"join": strings.Join,
-		}
-		tmpl, err := template.New("main").Funcs(fm).Parse(opt.entryFmt)
-		if err != nil {
-			return err
-		}
-		ewriter = writer.NewTemplate(tmpl, w)
-	case "checkstyle":
-		ewriter = writer.NewCheckStyle(w)
-	case "jsonl":
-		ewriter = writer.NewJSONL(w)
-	case "sarif":
-		var err error
-		ewriter, err = writer.NewSarif(w, sarifOpt)
-		if err != nil {
-			return err
-		}
-	default:
-		return fmt.Errorf("unknown writer: -w=%v", opt.writerFmt)
-	}
-	if ewriter, ok := ewriter.(writer.BufWriter); ok {
-		defer func() {
-			if err := ewriter.Flush(); err != nil {
-				log.Println(err)
-			}
-		}()
-	}
-
-	efm, err := errorformat.NewErrorformat(efms)
-	if err != nil {
-		return err
-	}
-	s := efm.NewScanner(r)
-	for s.Scan() {
-		if err := ewriter.Write(s.Entry()); err != nil {
-			return err
-		}
-	}
-	return nil
-}
diff --git a/cmd/errorformat/main_test.go b/cmd/errorformat/main_test.go
deleted file mode 100644
index 24ae25c..0000000
--- a/cmd/errorformat/main_test.go
+++ /dev/null
@@ -1,129 +0,0 @@
-package main
-
-import (
-	"bytes"
-	"strings"
-	"testing"
-
-	"github.com/reviewdog/errorformat/writer"
-)
-
-func TestRun(t *testing.T) {
-	tests := []struct {
-		in       string
-		efms     []string
-		entryFmt string
-		name     string
-		want     string
-	}{
-		{
-			in: `golint.new.go:3:5: exported var V should have comment or be unexported
-golint.new.go:5:5: exported var NewError1 should have comment or be unexported
-golint.new.go:7:1: comment on exported function F should be of the form "F ..."
-golint.new.go:11:1: comment on exported function F2 should be of the form "F2 ..."
-`,
-			efms:     []string{"%f:%l:%c: %m"},
-			entryFmt: "{{.String}}",
-			want: `golint.new.go|3 col 5| exported var V should have comment or be unexported
-golint.new.go|5 col 5| exported var NewError1 should have comment or be unexported
-golint.new.go|7 col 1| comment on exported function F should be of the form "F ..."
-golint.new.go|11 col 1| comment on exported function F2 should be of the form "F2 ..."
-`,
-		},
-		{
-			in: `golint.new.go:3:5: exported var V should have comment or be unexported
-golint.new.go:5:5: exported var NewError1 should have comment or be unexported
-golint.new.go:7:1: comment on exported function F should be of the form "F ..."
-golint.new.go:11:1: comment on exported function F2 should be of the form "F2 ..."
-`,
-			efms:     []string{"%f:%l:%c: %m"},
-			entryFmt: "{{.Filename}}",
-			want: `golint.new.go
-golint.new.go
-golint.new.go
-golint.new.go
-`,
-		},
-		{
-			in: `golint.new.go:3:5: exported var V should have comment or be unexported
-golint.new.go:5:5: exported var NewError1 should have comment or be unexported
-golint.new.go:7:1: comment on exported function F should be of the form "F ..."
-golint.new.go:11:1: comment on exported function F2 should be of the form "F2 ..."
-`,
-			entryFmt: "{{.Filename}}",
-			name:     "golint",
-			want: `golint.new.go
-golint.new.go
-golint.new.go
-golint.new.go
-`,
-		},
-	}
-
-	for _, tt := range tests {
-		out := new(bytes.Buffer)
-		opt := option{
-			entryFmt: tt.entryFmt,
-			name:     tt.name,
-		}
-		if err := run(strings.NewReader(tt.in), out, tt.efms, opt, writer.SarifOption{}); err != nil {
-			t.Error(err)
-		}
-		if got := out.String(); got != tt.want {
-			t.Errorf("got:\n%v\nwant:\n%v", got, tt.want)
-		}
-	}
-}
-
-func TestRun_checkstyle(t *testing.T) {
-	tests := []struct {
-		in   string
-		efms []string
-		want string
-	}{
-		{
-			in: `golint.new.go:3:5: exported var V should have comment or be unexported
-golint.new.go:5:5: exported var NewError1 should have comment or be unexported
-golint.new.go:7:1: comment on exported function F should be of the form "F ..."
-golint.new.go:11:1: comment on exported function F2 should be of the form "F2 ..."
-`,
-			efms: []string{"%f:%l:%c: %m"},
-			want: `<?xml version="1.0" encoding="UTF-8"?>
-<checkstyle version="1.0">
-  <file name="golint.new.go">
-    <error column="5" line="3" message="exported var V should have comment or be unexported"></error>
-    <error column="5" line="5" message="exported var NewError1 should have comment or be unexported"></error>
-    <error column="1" line="7" message="comment on exported function F should be of the form &#34;F ...&#34;"></error>
-    <error column="1" line="11" message="comment on exported function F2 should be of the form &#34;F2 ...&#34;"></error>
-  </file>
-</checkstyle>
-`,
-		},
-	}
-	for _, tt := range tests {
-		out := new(bytes.Buffer)
-		opt := option{writerFmt: "checkstyle"}
-		if err := run(strings.NewReader(tt.in), out, tt.efms, opt, writer.SarifOption{}); err != nil {
-			t.Error(err)
-		}
-		if got := out.String(); got != tt.want {
-			t.Errorf("got:\n%v\nwant:\n%v", got, tt.want)
-		}
-	}
-}
-
-func TestRun_unknown_writer(t *testing.T) {
-	opt := option{writerFmt: "unknown"}
-	if err := run(nil, nil, nil, opt, writer.SarifOption{}); err == nil {
-		t.Error("error expected but got nil")
-	}
-}
-
-func TestRun_list(t *testing.T) {
-	out := new(bytes.Buffer)
-	opt := option{list: true}
-	if err := run(nil, out, nil, opt, writer.SarifOption{}); err != nil {
-		t.Error(err)
-	}
-	t.Log(out.String())
-}
diff --git a/cmd/errorformat/testdata/golint.in b/cmd/errorformat/testdata/golint.in
deleted file mode 100644
index fbd1de3..0000000
--- a/cmd/errorformat/testdata/golint.in
+++ /dev/null
@@ -1,4 +0,0 @@
-golint.new.go:3:5: exported var V should have comment or be unexported
-golint.new.go:5:5: exported var NewError1 should have comment or be unexported
-golint.new.go:7:1: comment on exported function F should be of the form "F ..."
-golint.new.go:11:1: comment on exported function F2 should be of the form "F2 ..."
diff --git a/cmd/errorformat/testdata/golint.sh b/cmd/errorformat/testdata/golint.sh
deleted file mode 100644
index 15a4839..0000000
--- a/cmd/errorformat/testdata/golint.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#/bin/bash
-./errorformat "%f:%l:%c: %m" < testdata/golint.in
diff --git a/cmd/errorformat/testdata/grep.in b/cmd/errorformat/testdata/grep.in
deleted file mode 100644
index 95c451b..0000000
--- a/cmd/errorformat/testdata/grep.in
+++ /dev/null
@@ -1,7 +0,0 @@
-errorformat.go
-1:// Package errorformat provides 'errorformat' functionality of Vim. :h
-398:// NewEfm converts a 'errorformat' string to regular expression pattern with
-
-README.md
-1:## errorformat - vim 'errorformat' implementation in Go
-
diff --git a/cmd/errorformat/testdata/grep.sh b/cmd/errorformat/testdata/grep.sh
deleted file mode 100644
index 68e5fd8..0000000
--- a/cmd/errorformat/testdata/grep.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#/bin/bash
-./errorformat "%l:%m" "%-P%f" "%-Q" < testdata/grep.in
diff --git a/cmd/errorformat/testdata/sbt.in b/cmd/errorformat/testdata/sbt.in
deleted file mode 100644
index 003d191..0000000
--- a/cmd/errorformat/testdata/sbt.in
+++ /dev/null
@@ -1,18 +0,0 @@
-[warn] /path/to/F1.scala:203: local val in method f is never used: (warning smaple 3)
-[warn]         val x = 1
-[warn]             ^
-[warn] /path/to/F1.scala:204: local val in method f is never used: (warning smaple 2)
-[warn]   val x = 2
-[warn]       ^
-[error] /path/to/F2.scala:1093: error: value ++ is not a member of Int
-[error]     val x = 1 ++ 2
-[error]               ^
-[warn] /path/to/dir/F3.scala:83: local val in method f is never used
-[warn]         val x = 4
-[warn]             ^
-[error] /path/to/dir/F3.scala:84: error: value ++ is not a member of Int
-[error]         val x = 5 ++ 2
-[error]                   ^
-[warn] /path/to/dir/F3.scala:86: local val in method f is never used
-[warn]         val x = 6
-[warn]             ^
diff --git a/cmd/errorformat/testdata/sbt.sh b/cmd/errorformat/testdata/sbt.sh
deleted file mode 100644
index 930c0b9..0000000
--- a/cmd/errorformat/testdata/sbt.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#/bin/bash
-./errorformat "%E[%t%.%+] %f:%l: error: %m" "%A[%t%.%+] %f:%l: %m" "%Z[%.%+] %p^" "%C[%.%+] %.%#" "%-G%.%#" < testdata/sbt.in
