diff --git a/disk/disk_windows.go b/disk/disk_windows.go index 3e3d991..6aa47a7 100644 --- a/disk/disk_windows.go +++ b/disk/disk_windows.go @@ -15,6 +15,8 @@ import ( "golang.org/x/sys/windows/registry" ) +type Warnings = common.Warnings + var ( procGetDiskFreeSpaceExW = common.Modkernel32.NewProc("GetDiskFreeSpaceExW") procGetLogicalDriveStringsW = common.Modkernel32.NewProc("GetLogicalDriveStringsW") diff --git a/host/host_linux.go b/host/host_linux.go index 940415c..949baba 100644 --- a/host/host_linux.go +++ b/host/host_linux.go @@ -19,6 +19,8 @@ import ( "golang.org/x/sys/unix" ) +type Warnings = common.Warnings + type lsbStruct struct { ID string Release string diff --git a/host/warnings.go b/host/warnings.go deleted file mode 100644 index 182a293..0000000 --- a/host/warnings.go +++ /dev/null @@ -1,30 +0,0 @@ -package host - -import "fmt" - -type Warnings struct { - List []error - Verbose bool -} - -func (w *Warnings) Add(err error) { - w.List = append(w.List, err) -} - -func (w *Warnings) Reference() error { - if len(w.List) > 0 { - return w - } - return nil -} - -func (w *Warnings) Error() string { - if w.Verbose { - str := "" - for i, e := range w.List { - str += fmt.Sprintf("\tError %d: %s\n", i, e.Error()) - } - return str - } - return fmt.Sprintf("Number of warnings: %v", len(w.List)) -} diff --git a/disk/warnings.go b/internal/common/warnings.go similarity index 96% rename from disk/warnings.go rename to internal/common/warnings.go index ce13aa9..a4aaada 100644 --- a/disk/warnings.go +++ b/internal/common/warnings.go @@ -1,4 +1,4 @@ -package disk +package common import "fmt"