From ed2073111d0373228c7dfd95dca877bb9420a987 Mon Sep 17 00:00:00 2001 From: Nick White Date: Thu, 27 Oct 2022 16:36:31 +0100 Subject: Pass log around as pointer to fix go vet pointing out that this meant copying a sync.Mutex --- cmd/rescribe/gui.go | 2 +- cmd/rescribe/main.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'cmd') diff --git a/cmd/rescribe/gui.go b/cmd/rescribe/gui.go index f03d66e..ef58fce 100644 --- a/cmd/rescribe/gui.go +++ b/cmd/rescribe/gui.go @@ -219,7 +219,7 @@ func formatProgressBarText(bar *widget.ProgressBar) func() string { } // startGui starts the gui process -func startGui(log log.Logger, cmd string, gbookcmd string, training string, tessdir string) error { +func startGui(log *log.Logger, cmd string, gbookcmd string, training string, tessdir string) error { myApp := app.New() myWindow := myApp.NewWindow("Rescribe OCR") diff --git a/cmd/rescribe/main.go b/cmd/rescribe/main.go index c9118a8..74f6440 100644 --- a/cmd/rescribe/main.go +++ b/cmd/rescribe/main.go @@ -259,7 +259,7 @@ These training files are included in rescribe, and are always available: } if flag.NArg() < 1 || *usegui { - err := startGui(*verboselog, tessCommand, gbookCommand, trainingName, tessdir) + err := startGui(verboselog, tessCommand, gbookCommand, trainingName, tessdir) err = os.RemoveAll(tessdir) if err != nil { log.Printf("Error removing tesseract directory %s: %v", tessdir, err) @@ -319,7 +319,7 @@ These training files are included in rescribe, and are always available: ispdf = true } - err = startProcess(ctx, *verboselog, tessCommand, bookdir, bookname, trainingName, savedir, tessdir, !*wipe, *fullpdf) + err = startProcess(ctx, verboselog, tessCommand, bookdir, bookname, trainingName, savedir, tessdir, !*wipe, *fullpdf) if err != nil { log.Fatalln(err) } @@ -459,7 +459,7 @@ func rmIfNotImage(f string) error { return nil } -func startProcess(ctx context.Context, logger log.Logger, tessCommand string, bookdir string, bookname string, trainingName string, savedir string, tessdir string, nowipe bool, fullpdf bool) error { +func startProcess(ctx context.Context, logger *log.Logger, tessCommand string, bookdir string, bookname string, trainingName string, savedir string, tessdir string, nowipe bool, fullpdf bool) error { cmd := exec.Command(tessCommand, "--help") pipeline.HideCmd(cmd) _, err := cmd.Output() @@ -478,7 +478,7 @@ func startProcess(ctx context.Context, logger log.Logger, tessCommand string, bo } var conn Pipeliner - conn = &bookpipeline.LocalConn{Logger: &logger, TempDir: tempdir} + conn = &bookpipeline.LocalConn{Logger: logger, TempDir: tempdir} conn.Log("Setting up session") err = conn.Init() -- cgit v1.2.1-24-ge1ad