mirror of https://bitbucket.org/ausocean/av.git
fixed various things particularly use of %w formatting directive in wrong places to satisfy repo testing
This commit is contained in:
parent
6fd5fe55cb
commit
606b784f5e
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue