A Go package that access to Memory Devices information.
go get -u github.com/bitcav/go-memdev
package main
import (
"encoding/json"
"fmt"
"github.com/bitcav/go-memdev"
)
func main() {
memInfo, _ := memdev.Info() //the returned value is a struct
jsonOutput, _ := json.MarshalIndent(memInfo, "", " ")
fmt.Println(string(jsonOutput))
}
The output is below.
[
{
"bank": "DIMM A",
"size": 4096,
"unit": "MB",
"type": "FBD2",
"formFactor": "SODIMM",
"manufacturer": "Samsung",
"serial": "A49F8D93",
"assetTag": "03153300",
"partNumber": "M471B5173DB0-YK0 ",
"speed": 1600,
"dataWidth": 64,
"totalWidth": 64
}
]
go build
🔒 In order to access the system BIOS requires running with elevated privileges.
- Linux:
sudo ./main
- Windows:
You can launch the program as an administrator by right-clicking on the executable file and choosing "Run as administrator."