found out the root cause of issue, reverting change

This commit is contained in:
lin committed 2026-10-05 18:23:45 +02:00
1 parent dd2dc67e4e
commit b85014bc70
1 file changed
+6 -5
+6 -5
View File
@@ -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()
fields := strings.Split(line, " ") if strings.HasPrefix(line, "cpu ") {
for _, field := range fields { fields := strings.Split(line, " ")
fmt.Print(field) for _, field := range fields {
fmt.Print(field)
}
} }
} }
if fileReader.Err() != nil { if fileReader.Err() != nil {