Skip to content

Commit

Permalink
fix Windows and Darwin builds
Browse files Browse the repository at this point in the history
Forgot to change the module function signatures for BIOS and baseboard
modules in Windows and Darwin.

Signed-off-by: Jay Pipes <jaypipes@gmail.com>
  • Loading branch information
jaypipes committed Jan 1, 2024
1 parent 86db20a commit bf27445
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
3 changes: 2 additions & 1 deletion pkg/baseboard/baseboard_stub.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
package baseboard

import (
"context"
"runtime"

"github.com/pkg/errors"
)

func (i *Info) load() error {
func (i *Info) load(_ context.Context) error {
return errors.New("baseboardFillInfo not implemented on " + runtime.GOOS)
}
4 changes: 3 additions & 1 deletion pkg/baseboard/baseboard_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
package baseboard

import (
"context"

"github.com/StackExchange/wmi"
)

Expand All @@ -19,7 +21,7 @@ type win32Baseboard struct {
Product *string
}

func (i *Info) load() error {
func (i *Info) load(_ context.Context) error {
// Getting data from WMI
var win32BaseboardDescriptions []win32Baseboard
if err := wmi.Query(wqlBaseboard, &win32BaseboardDescriptions); err != nil {
Expand Down
3 changes: 2 additions & 1 deletion pkg/bios/bios_stub.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
package bios

import (
"context"
"runtime"

"github.com/pkg/errors"
)

func (i *Info) load() error {
func (i *Info) load(_ context.Context) error {
return errors.New("biosFillInfo not implemented on " + runtime.GOOS)
}
4 changes: 3 additions & 1 deletion pkg/bios/bios_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
package bios

import (
"context"

"github.com/StackExchange/wmi"
)

Expand All @@ -17,7 +19,7 @@ type win32BIOS struct {
Version *string
}

func (i *Info) load() error {
func (i *Info) load(_ context.Context) error {
// Getting data from WMI
var win32BIOSDescriptions []win32BIOS
if err := wmi.Query(wqlBIOS, &win32BIOSDescriptions); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/memory/memory_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

"github.com/StackExchange/wmi"

"github.com/go-hardware/ghw/pkg/unitutil"
"github.com/go-hardware/ghw/pkg/unit"
)

const wqlOperatingSystem = "SELECT TotalVisibleMemorySize FROM Win32_OperatingSystem"
Expand Down Expand Up @@ -66,7 +66,7 @@ func (i *Info) load(_ context.Context) error {
for _, description := range win32OSDescriptions {
// TotalVisibleMemorySize is the amount of memory available for us by
// the operating system **in Kilobytes**
totalUsableBytes += *description.TotalVisibleMemorySize * uint64(unitutil.KB)
totalUsableBytes += *description.TotalVisibleMemorySize * uint64(unit.KB)
}
i.TotalUsableBytes = int64(totalUsableBytes)
i.TotalPhysicalBytes = int64(totalPhysicalBytes)
Expand Down

0 comments on commit bf27445

Please sign in to comment.