diff --git a/internal/system_check/linux_ram.go b/internal/system_check/linux_ram.go index bf9c9c6..f004788 100644 --- a/internal/system_check/linux_ram.go +++ b/internal/system_check/linux_ram.go @@ -1,3 +1,5 @@ +//go:build linux + package system_check import ( @@ -47,3 +49,7 @@ func getLinuxRamInfo() (MemoryInformation, error) { AvailableMemory: AvailMemory, }, nil } + +func GetRamInformation() (MemoryInformation, error) { + return getLinuxRamInfo() +} diff --git a/internal/system_check/ram.go b/internal/system_check/ram.go index 7918f37..c1b90c1 100644 --- a/internal/system_check/ram.go +++ b/internal/system_check/ram.go @@ -1,10 +1,5 @@ package system_check -import ( - "fmt" - "runtime" -) - type MemoryInformation struct { /* * The total amount of memory the system has available @@ -19,14 +14,3 @@ type MemoryInformation struct { func (memInfo MemoryInformation) GetUsedMemory() uint64 { return memInfo.SystemMemory - memInfo.AvailableMemory } - -func GetRamInformation() (MemoryInformation, error) { - switch runtime.GOOS { - case "windows": - return getWinRamInfo(getWindowsTools().ProcGlobalMemoryStatusEx), nil - case "linux": - return getLinuxRamInfo() - default: - return MemoryInformation{}, fmt.Errorf("Unsupported OS: \"%s\"", runtime.GOOS) - } -} diff --git a/internal/system_check/win.go b/internal/system_check/win.go index daf01d0..b6e69bc 100644 --- a/internal/system_check/win.go +++ b/internal/system_check/win.go @@ -1,3 +1,5 @@ +//go:build windows + package system_check import ( diff --git a/internal/system_check/win_ram.go b/internal/system_check/win_ram.go index dbf8a22..4ed2e6a 100644 --- a/internal/system_check/win_ram.go +++ b/internal/system_check/win_ram.go @@ -1,3 +1,5 @@ +//go:build windows + package system_check import ( @@ -42,3 +44,7 @@ func getWinRamInfo(procGlobalMemoryStatusEx *windows.LazyProc) MemoryInformation AvailableMemory: mem.ullAvailPhys, } } + +func GetRamInformation() (MemoryInformation, error) { + return getWinRamInfo(getWindowsTools().ProcGlobalMemoryStatusEx), nil +}