mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
daemon/stats: fix notRunningErr / notFoundErr detected as unused (false positive)
Also looks like a false positive, but given that these were basically
testing for the `errdefs.Conflict` and `errdefs.NotFound` interfaces, I
replaced these with those;
daemon/stats/collector.go:154:6: type `notRunningErr` is unused (unused)
type notRunningErr interface {
^
daemon/stats/collector.go:159:6: type `notFoundErr` is unused (unused)
type notFoundErr interface {
^
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 09191c0936
)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
db7b3f4737
commit
14b475d091
1 changed files with 2 additions and 11 deletions
|
@ -7,6 +7,7 @@ import (
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"github.com/docker/docker/container"
|
"github.com/docker/docker/container"
|
||||||
|
"github.com/docker/docker/errdefs"
|
||||||
"github.com/docker/docker/pkg/pubsub"
|
"github.com/docker/docker/pkg/pubsub"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
@ -131,7 +132,7 @@ func (s *Collector) Run() {
|
||||||
|
|
||||||
pair.publisher.Publish(*stats)
|
pair.publisher.Publish(*stats)
|
||||||
|
|
||||||
case notRunningErr, notFoundErr:
|
case errdefs.ErrConflict, errdefs.ErrNotFound:
|
||||||
// publish empty stats containing only name and ID if not running or not found
|
// publish empty stats containing only name and ID if not running or not found
|
||||||
pair.publisher.Publish(types.StatsJSON{
|
pair.publisher.Publish(types.StatsJSON{
|
||||||
Name: pair.container.Name,
|
Name: pair.container.Name,
|
||||||
|
@ -150,13 +151,3 @@ func (s *Collector) Run() {
|
||||||
time.Sleep(s.interval)
|
time.Sleep(s.interval)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type notRunningErr interface {
|
|
||||||
error
|
|
||||||
Conflict()
|
|
||||||
}
|
|
||||||
|
|
||||||
type notFoundErr interface {
|
|
||||||
error
|
|
||||||
NotFound()
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue