1
0
Fork 0
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:
Sebastiaan van Stijn 2021-04-16 22:04:29 +02:00
parent db7b3f4737
commit 14b475d091
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

View file

@ -7,6 +7,7 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/container"
"github.com/docker/docker/errdefs"
"github.com/docker/docker/pkg/pubsub"
"github.com/sirupsen/logrus"
)
@ -131,7 +132,7 @@ func (s *Collector) Run() {
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
pair.publisher.Publish(types.StatsJSON{
Name: pair.container.Name,
@ -150,13 +151,3 @@ func (s *Collector) Run() {
time.Sleep(s.interval)
}
}
type notRunningErr interface {
error
Conflict()
}
type notFoundErr interface {
error
NotFound()
}