Skip to content

Commit e7c6b69

Browse files
committed
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
1 parent c7c548d commit e7c6b69

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

disk/disk.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import (
99

1010
var invoke common.Invoker = common.Invoke{}
1111

12+
type Warnings = common.Warnings
13+
1214
type UsageStat struct {
1315
Path string `json:"path"`
1416
Fstype string `json:"fstype"`

disk/disk_windows.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ import (
1515
"golang.org/x/sys/windows/registry"
1616
)
1717

18-
type Warnings = common.Warnings
19-
2018
var (
2119
procGetDiskFreeSpaceExW = common.Modkernel32.NewProc("GetDiskFreeSpaceExW")
2220
procGetLogicalDriveStringsW = common.Modkernel32.NewProc("GetLogicalDriveStringsW")

host/host.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import (
1111
"github.com/shirou/gopsutil/v3/internal/common"
1212
)
1313

14+
type Warnings = common.Warnings
15+
1416
var invoke common.Invoker = common.Invoke{}
1517

1618
// A HostInfoStat describes the host status.

host/host_linux.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ import (
1919
"golang.org/x/sys/unix"
2020
)
2121

22-
type Warnings = common.Warnings
23-
2422
type lsbStruct struct {
2523
ID string
2624
Release string

0 commit comments

Comments
 (0)