Skip to content

Commit

Permalink
🧹 Fix windows build. (#2978)
Browse files Browse the repository at this point in the history
Signed-off-by: Preslav <[email protected]>
  • Loading branch information
preslavgerchev authored Jan 8, 2024
1 parent 678fc69 commit 19ce10a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions providers/os/detector/windows/build_version_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@ package windows
import (
"runtime"

"go.mondoo.com/cnquery/v9/providers/os/connection"
"go.mondoo.com/cnquery/v9/providers/os/connection/shared"
"golang.org/x/sys/windows/registry"
)

func GetWindowsOSBuild(conn shared.Connection) (*WindowsCurrentVersion, error) {
// if we are running locally on windows, we want to avoid using powershell to be faster
if conn.Type() == connection.Local && runtime.GOOS == "windows" {
if conn.Type() == shared.Type_Local && runtime.GOOS == "windows" {
k, err := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\Microsoft\Windows NT\CurrentVersion`, registry.QUERY_VALUE)
if err != nil {
return nil, err
Expand Down
3 changes: 1 addition & 2 deletions providers/os/detector/windows/wmi_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ import (
"strconv"

wmi "github.com/StackExchange/wmi"
"go.mondoo.com/cnquery/v9/providers/os/connection"
"go.mondoo.com/cnquery/v9/providers/os/connection/shared"
)

const wmiOSQuery = "SELECT Name, Caption, Manufacturer, OSArchitecture, Version, BuildNumber, Description, OSType, ProductType, SerialNumber FROM Win32_OperatingSystem"

func GetWmiInformation(conn shared.Connection) (*WmicOSInformation, error) {
// if we are running locally on windows, we want to avoid using powershell to be faster
if conn.Type() == connection.Local && runtime.GOOS == "windows" {
if conn.Type() == shared.Type_Local && runtime.GOOS == "windows" {

// we always get a list or entries
type win32_OperatingSystem struct {
Expand Down
3 changes: 1 addition & 2 deletions providers/os/id/platformid/win_guid_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ import (
"runtime"

wmi "github.com/StackExchange/wmi"
"go.mondoo.com/cnquery/v9/providers/os/connection"
"go.mondoo.com/cnquery/v9/providers/os/connection/shared"
)

func windowsMachineId(conn shared.Connection) (string, error) {
// if we are running locally on windows, we want to avoid using powershell to be faster
if conn.Type() == connection.Local && runtime.GOOS == "windows" {
if conn.Type() == shared.Type_Local && runtime.GOOS == "windows" {
// we always get a list or entries
type win32ComputerSystemProduct struct {
UUID *string
Expand Down

0 comments on commit 19ce10a

Please sign in to comment.