found out the root cause of issue, reverting change
This commit is contained in:
1 parent
dd2dc67e4e
commit
b85014bc70
1 file changed
+3
-2
@@ -14,7 +14,7 @@ import (
|
|||||||
var numberRegex *regexp.Regexp = regexp.MustCompile(`\d+`)
|
var numberRegex *regexp.Regexp = regexp.MustCompile(`\d+`)
|
||||||
|
|
||||||
func getLinuxCpuInfo() (ProcessorInformation, error) {
|
func getLinuxCpuInfo() (ProcessorInformation, error) {
|
||||||
procFile, err := os.Open("/proc/meminfo")
|
procFile, err := os.Open("/proc/loadavg")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ProcessorInformation{}, fmt.Errorf("Could not find /proc/meminfo. Are you sure you are on linux?")
|
return ProcessorInformation{}, fmt.Errorf("Could not find /proc/meminfo. Are you sure you are on linux?")
|
||||||
}
|
}
|
||||||
@@ -29,11 +29,12 @@ func getLinuxCpuInfo() (ProcessorInformation, error) {
|
|||||||
for fileReader.Scan() {
|
for fileReader.Scan() {
|
||||||
line := fileReader.Text()
|
line := fileReader.Text()
|
||||||
|
|
||||||
|
if strings.HasPrefix(line, "cpu ") {
|
||||||
fields := strings.Split(line, " ")
|
fields := strings.Split(line, " ")
|
||||||
for _, field := range fields {
|
for _, field := range fields {
|
||||||
fmt.Print(field)
|
fmt.Print(field)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if fileReader.Err() != nil {
|
if fileReader.Err() != nil {
|
||||||
|
|||||||
Reference in new issue
Block a user