From 606b784f5ecdff7ac788fd6a6dd850d5c0e6266b Mon Sep 17 00:00:00 2001 From: Saxon Nelson-Milton Date: Sat, 19 Dec 2020 13:43:23 +1030 Subject: [PATCH] fixed various things particularly use of %w formatting directive in wrong places to satisfy repo testing --- device/alsa/alsa_test.go | 4 ++-- device/file/file_test.go | 4 ++-- device/geovision/config/config_test.go | 4 ++-- device/geovision/geovision_test.go | 4 ++-- device/raspivid/raspivid_test.go | 4 ++-- device/webcam/webcam_test.go | 4 ++-- exp/rvcl/main.go | 12 ++++++------ 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/device/alsa/alsa_test.go b/device/alsa/alsa_test.go index 6c2b5a77..d91c8ad9 100644 --- a/device/alsa/alsa_test.go +++ b/device/alsa/alsa_test.go @@ -127,12 +127,12 @@ func TestIsRunning(t *testing.T) { InputCodec: codecutil.ADPCM, }) if err != nil { - t.Skipf("could not set device: %w", err) + t.Skipf("could not set device: %v", err) } err = d.Start() if err != nil { - t.Fatalf("could not start device %w", err) + t.Fatalf("could not start device %v", err) } time.Sleep(dur) diff --git a/device/file/file_test.go b/device/file/file_test.go index 6bf547f4..53e90be5 100644 --- a/device/file/file_test.go +++ b/device/file/file_test.go @@ -41,12 +41,12 @@ func TestIsRunning(t *testing.T) { InputPath: path, }) if err != nil { - t.Skipf("could not set device: %w", err) + t.Skipf("could not set device: %v", err) } err = d.Start() if err != nil { - t.Fatalf("could not start device %w", err) + t.Fatalf("could not start device %v", err) } time.Sleep(dur) diff --git a/device/geovision/config/config_test.go b/device/geovision/config/config_test.go index fd52bbd3..1862d149 100644 --- a/device/geovision/config/config_test.go +++ b/device/geovision/config/config_test.go @@ -153,13 +153,13 @@ func TestCodecOut(t *testing.T) { }, { s: settings{ch: 1}, - c: Codec(500), + c: Codec("500"), want: settings{ch: 1}, err: true, }, { s: settings{ch: 2}, - c: Codec(500), + c: Codec("500"), want: settings{ch: 2}, err: true, }, diff --git a/device/geovision/geovision_test.go b/device/geovision/geovision_test.go index 784313e3..c06ee98b 100644 --- a/device/geovision/geovision_test.go +++ b/device/geovision/geovision_test.go @@ -47,12 +47,12 @@ func TestIsRunning(t *testing.T) { CameraIP: ip, }) if err != nil { - t.Skipf("could not set device: %w", err) + t.Skipf("could not set device: %v", err) } err = d.Start() if err != nil { - t.Fatalf("could not start device %w", err) + t.Fatalf("could not start device %v", err) } time.Sleep(dur) diff --git a/device/raspivid/raspivid_test.go b/device/raspivid/raspivid_test.go index 76a54e3c..f6fa2ec5 100644 --- a/device/raspivid/raspivid_test.go +++ b/device/raspivid/raspivid_test.go @@ -45,12 +45,12 @@ func TestIsRunning(t *testing.T) { InputCodec: codecutil.H264, }) if err != nil { - t.Skipf("could not set device: %w", err) + t.Skipf("could not set device: %v", err) } err = d.Start() if err != nil { - t.Fatalf("could not start device %w", err) + t.Fatalf("could not start device %v", err) } time.Sleep(dur) diff --git a/device/webcam/webcam_test.go b/device/webcam/webcam_test.go index 3c58c6e8..e653c86d 100644 --- a/device/webcam/webcam_test.go +++ b/device/webcam/webcam_test.go @@ -45,12 +45,12 @@ func TestIsRunning(t *testing.T) { InputCodec: codecutil.H264, }) if err != nil { - t.Skipf("could not set device: %w", err) + t.Skipf("could not set device: %v", err) } err = d.Start() if err != nil { - t.Fatalf("could not start device %w", err) + t.Fatalf("could not start device %v", err) } time.Sleep(dur) diff --git a/exp/rvcl/main.go b/exp/rvcl/main.go index 7f9ff87f..ed1e1b97 100644 --- a/exp/rvcl/main.go +++ b/exp/rvcl/main.go @@ -129,16 +129,16 @@ func main() { case *configPtr != "": // Decode JSON file to map. err = json.Unmarshal([]byte(*configPtr), &cfg) if err != nil { - panic(fmt.Sprintf("could not decode JSON config: %w", err)) + panic(fmt.Sprintf("could not decode JSON config: %v", err)) } case *configFilePtr != "": // Decode JSON string to map from command line flag. f, err := os.Open(*configFilePtr) if err != nil { - panic(fmt.Sprintf("could not open config file: %w", err)) + panic(fmt.Sprintf("could not open config file: %v", err)) } err = json.NewDecoder(f).Decode(&cfg) if err != nil { - panic(fmt.Sprintf("could not decode JSON config: %w", err)) + panic(fmt.Sprintf("could not decode JSON config: %v", err)) } default: // No config information has been provided; give empty map to force defaults. cfg = map[string]string{} @@ -167,19 +167,19 @@ func main() { rv, err := revid.New(config.Config{Logger: log}, ns) if err != nil { - panic(fmt.Sprintf("could not create revid: %w", err)) + panic(fmt.Sprintf("could not create revid: %v", err)) } // Configure revid with configuration map obtained through flags or file. // If config is empty, defaults will be adopted by revid. err = rv.Update(cfg) if err != nil { - panic(fmt.Sprintf("could not update revid config: %w", err)) + panic(fmt.Sprintf("could not update revid config: %v", err)) } err = rv.Start() if err != nil { - panic(fmt.Sprintf("could not start revid: %w", err)) + panic(fmt.Sprintf("could not start revid: %v", err)) } // Run indefinitely.