From cefb3d7f52dc96d104d823ae9f9523654ffc19d8 Mon Sep 17 00:00:00 2001 From: "James W. Brinkerhoff" Date: Wed, 7 Aug 2024 12:00:24 -0400 Subject: [PATCH] internal/executor: Remove unused interface funcs --- internal/executor/executor.go | 40 +++++++++++++++--------------- internal/executor/executor_test.go | 1 - internal/sum/sum.go | 1 - 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/internal/executor/executor.go b/internal/executor/executor.go index 48e202ca..bf524785 100644 --- a/internal/executor/executor.go +++ b/internal/executor/executor.go @@ -16,12 +16,12 @@ type Executor interface { ExecWithContext(context.Context) (*Result, error) SetArgs([]string) SetEnv([]string) - SetQuiet() - SetVerbose() + // SetQuiet() + // SetVerbose() GetCmd() string - DisableBinCheck() - SetStdin(io.Reader) - CmdPath() string + // DisableBinCheck() + // SetStdin(io.Reader) + // CmdPath() string CheckExecutable() error // for tests SetStdout([]byte) @@ -60,9 +60,9 @@ func (e *Execute) GetCmd() string { // CmdPath returns the absolute path to the executable // this means the caller should not have disabled CheckBin. -func (e *Execute) CmdPath() string { - return e.Cmd -} +// func (e *Execute) CmdPath() string { +// return e.Cmd +// } // SetArgs sets the command args func (e *Execute) SetArgs(a []string) { @@ -75,24 +75,24 @@ func (e *Execute) SetEnv(env []string) { } // SetQuiet lowers the verbosity -func (e *Execute) SetQuiet() { - e.Quiet = true -} +// func (e *Execute) SetQuiet() { +// e.Quiet = true +// } // SetVerbose does whats it says -func (e *Execute) SetVerbose() { - e.Quiet = false -} +// func (e *Execute) SetVerbose() { +// e.Quiet = false +// } // SetStdin sets the reader to the command stdin -func (e *Execute) SetStdin(r io.Reader) { - e.Stdin = r -} +// func (e *Execute) SetStdin(r io.Reader) { +// e.Stdin = r +// } // DisableBinCheck disables validating the binary exists and is executable -func (e *Execute) DisableBinCheck() { - e.CheckBin = false -} +// func (e *Execute) DisableBinCheck() { +// e.CheckBin = false +// } // SetStdout doesn't do much, is around for tests func (e *Execute) SetStdout(_ []byte) { diff --git a/internal/executor/executor_test.go b/internal/executor/executor_test.go index fa1c6e93..87079c84 100644 --- a/internal/executor/executor_test.go +++ b/internal/executor/executor_test.go @@ -17,7 +17,6 @@ func Test_Stdin(t *testing.T) { e.Cmd = "grep" e.Args = []string{"hello"} e.Stdin = bytes.NewReader([]byte("hello")) - e.SetQuiet() result, err := e.ExecWithContext(context.Background()) if err != nil { diff --git a/internal/sum/sum.go b/internal/sum/sum.go index 0eb28179..b643a959 100644 --- a/internal/sum/sum.go +++ b/internal/sum/sum.go @@ -68,7 +68,6 @@ func New(host, user, pass string, opts ...Option) (*Sum, error) { e := ex.NewExecutor(sum.SumPath) e.SetEnv([]string{"LC_ALL=C.UTF-8"}) - // e.SetQuiet() sum.Executor = e return sum, nil