From e7c6b6991d4fb228e190798b65fe924ff1f1a90d Mon Sep 17 00:00:00 2001 From: Josh Powers Date: Wed, 15 Mar 2023 06:39:08 -0600 Subject: [PATCH] fix: moves common.Warnings to common OS files This allows all OS types to unwrap the Warnings from errors, and not just linux in host or windows in disk. fixes: #1429 --- disk/disk.go | 2 ++ disk/disk_windows.go | 2 -- host/host.go | 2 ++ host/host_linux.go | 2 -- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/disk/disk.go b/disk/disk.go index dd4cc1d5f..0d4b25345 100644 --- a/disk/disk.go +++ b/disk/disk.go @@ -9,6 +9,8 @@ import ( var invoke common.Invoker = common.Invoke{} +type Warnings = common.Warnings + type UsageStat struct { Path string `json:"path"` Fstype string `json:"fstype"` diff --git a/disk/disk_windows.go b/disk/disk_windows.go index 5dfd1ca98..dee21f6a6 100644 --- a/disk/disk_windows.go +++ b/disk/disk_windows.go @@ -15,8 +15,6 @@ 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.go b/host/host.go index f363eed83..c7e84e3a5 100644 --- a/host/host.go +++ b/host/host.go @@ -11,6 +11,8 @@ import ( "github.com/shirou/gopsutil/v3/internal/common" ) +type Warnings = common.Warnings + var invoke common.Invoker = common.Invoke{} // A HostInfoStat describes the host status. diff --git a/host/host_linux.go b/host/host_linux.go index 7f96bfaef..2ff0c268e 100644 --- a/host/host_linux.go +++ b/host/host_linux.go @@ -19,8 +19,6 @@ import ( "golang.org/x/sys/unix" ) -type Warnings = common.Warnings - type lsbStruct struct { ID string Release string