diff --git a/go.mod b/go.mod index fe632dd..38f3249 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,5 @@ module github.com/zcalusic/sysinfo go 1.20 + +require github.com/google/uuid v1.3.1 diff --git a/go.sum b/go.sum index e69de29..a43f94d 100644 --- a/go.sum +++ b/go.sum @@ -0,0 +1,2 @@ +github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= +github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= diff --git a/product.go b/product.go index 382b56d..83b0897 100644 --- a/product.go +++ b/product.go @@ -4,12 +4,16 @@ package sysinfo +import "github.com/google/uuid" + // Product information. type Product struct { - Name string `json:"name,omitempty"` - Vendor string `json:"vendor,omitempty"` - Version string `json:"version,omitempty"` - Serial string `json:"serial,omitempty"` + Name string `json:"name,omitempty"` + Vendor string `json:"vendor,omitempty"` + Version string `json:"version,omitempty"` + Serial string `json:"serial,omitempty"` + UUID uuid.UUID `json:"uuid,omitempty"` + SKU string `json:"sku,omitempty"` } func (si *SysInfo) getProductInfo() { @@ -17,4 +21,10 @@ func (si *SysInfo) getProductInfo() { si.Product.Vendor = slurpFile("/sys/class/dmi/id/sys_vendor") si.Product.Version = slurpFile("/sys/class/dmi/id/product_version") si.Product.Serial = slurpFile("/sys/class/dmi/id/product_serial") + si.Product.SKU = slurpFile("/sys/class/dmi/id/product_sku") + + uid, err := uuid.Parse(slurpFile("/sys/class/dmi/id/product_uuid")) + if err == nil { + si.Product.UUID = uid + } }