fixed various things particularly use of %w formatting directive in wrong places to satisfy repo testing

This commit is contained in:
Saxon Nelson-Milton 2020-12-19 13:43:23 +10:30
parent 6fd5fe55cb
commit 606b784f5e
7 changed files with 18 additions and 18 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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,
},

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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.