Skip to content

Commit

Permalink
Move ErrDeviceNotInPartitionsMap outside of the build constraints
Browse files Browse the repository at this point in the history
This allows using the error type on non Linux systems as well.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
  • Loading branch information
saschagrunert committed Nov 30, 2021
1 parent 99d3532 commit ab821e8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 0 additions & 4 deletions fs/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package fs

import (
"bufio"
"errors"
"fmt"
"io/ioutil"
"os"
Expand Down Expand Up @@ -59,9 +58,6 @@ const (
// A pool for restricting the number of consecutive `du` and `find` tasks running.
var pool = make(chan struct{}, maxConcurrentOps)

// ErrDeviceNotInPartitionsMap is the error resulting if a device could not be found in the partitions map.
var ErrDeviceNotInPartitionsMap = errors.New("could not find device in cached partitions map")

func init() {
for i := 0; i < maxConcurrentOps; i++ {
releaseToken()
Expand Down
9 changes: 7 additions & 2 deletions fs/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,13 @@ type UsageInfo struct {
Inodes uint64
}

// ErrNoSuchDevice is the error indicating the requested device does not exist.
var ErrNoSuchDevice = errors.New("cadvisor: no such device")
var (
// ErrNoSuchDevice is the error indicating the requested device does not exist.
ErrNoSuchDevice = errors.New("cadvisor: no such device")

// ErrDeviceNotInPartitionsMap is the error resulting if a device could not be found in the partitions map.
ErrDeviceNotInPartitionsMap = errors.New("could not find device in cached partitions map")
)

type FsInfo interface {
// Returns capacity and free space, in bytes, of all the ext2, ext3, ext4 filesystems on the host.
Expand Down

0 comments on commit ab821e8

Please sign in to comment.