StackExchange / wmi

WMI for Go
http://godoc.org/github.com/StackExchange/wmi
MIT License
434 stars 173 forks source link

Add support for float32 and float 64 types #15

Closed marianob85 closed 8 years ago

marianob85 commented 8 years ago

Need support for float32 and float64 types which are return from OpenHardwareMonitor software

marianob85 commented 8 years ago

Merged https://github.com/StackExchange/wmi/pull/17

yinhm commented 7 years ago

Error on Windows 7, Open Hardware Monitor v 0.7.1 beta

$ go run main.go
2016/10/14 00:16:09 wmi: cannot load field "Value" into a "float32": unsupported
 type (float32)
exit status 1
// +build windows

package main

import (
    "log"

    "github.com/StackExchange/wmi"
)

type OpenHardwareMonitorData struct {
    Name       string
    SensorType string
    Parent     string
    Value      float32  // running ok when remove this line
}

func main() {
    // query := wmi.CreateQuery(&dst, "")
    query := "select * from Sensor where Identifier = '/ram/data/0'"
    var dst []OpenHardwareMonitorData
    err := wmi.QueryNamespace(query, &dst, "root/OpenHardwareMonitor")
    if err != nil {
        log.Fatal(err)
    }

    log.Println(dst)
}
yinhm commented 7 years ago

ignore the above message, it appears I have a much older version WMI on this machine and forgot to update it.