mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2024-11-10 12:37:25 +01:00
ioutil.ReadFile is deprecated: As of Go 1.16, this function simply calls os.ReadFile
This commit is contained in:
parent
62720dec13
commit
013aa9ec92
@ -101,7 +101,7 @@ func getMetricData(lines []string, prefix string, offset int) (int64, error) {
|
|||||||
// llitedir := filepath.Join(LUSTRE_SYSFS, "llite")
|
// llitedir := filepath.Join(LUSTRE_SYSFS, "llite")
|
||||||
// devdir := filepath.Join(llitedir, device)
|
// devdir := filepath.Join(llitedir, device)
|
||||||
// statsfile := filepath.Join(devdir, "stats")
|
// statsfile := filepath.Join(devdir, "stats")
|
||||||
// buffer, err := ioutil.ReadFile(statsfile)
|
// buffer, err := os.ReadFile(statsfile)
|
||||||
// if err != nil {
|
// if err != nil {
|
||||||
// return make([]string, 0)
|
// return make([]string, 0)
|
||||||
// }
|
// }
|
||||||
|
@ -2,7 +2,6 @@ package ccTopology
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -31,7 +30,7 @@ func intArrayContains(array []int, str int) (int, bool) {
|
|||||||
|
|
||||||
// Used internally for sysfs file reads
|
// Used internally for sysfs file reads
|
||||||
func fileToInt(path string) int {
|
func fileToInt(path string) int {
|
||||||
buffer, err := ioutil.ReadFile(path)
|
buffer, err := os.ReadFile(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Print(err)
|
log.Print(err)
|
||||||
cclogger.ComponentError("ccTopology", "Reading", path, ":", err.Error())
|
cclogger.ComponentError("ccTopology", "Reading", path, ":", err.Error())
|
||||||
@ -50,7 +49,7 @@ func fileToInt(path string) int {
|
|||||||
|
|
||||||
// Get list of CPU socket IDs
|
// Get list of CPU socket IDs
|
||||||
func SocketList() []int {
|
func SocketList() []int {
|
||||||
buffer, err := ioutil.ReadFile(string(PROCFS_CPUINFO))
|
buffer, err := os.ReadFile(string(PROCFS_CPUINFO))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Print(err)
|
log.Print(err)
|
||||||
return nil
|
return nil
|
||||||
@ -76,7 +75,7 @@ func SocketList() []int {
|
|||||||
|
|
||||||
// Get list of hardware thread IDs in the order of listing in /proc/cpuinfo
|
// Get list of hardware thread IDs in the order of listing in /proc/cpuinfo
|
||||||
func HwthreadList() []int {
|
func HwthreadList() []int {
|
||||||
buffer, err := ioutil.ReadFile(string(PROCFS_CPUINFO))
|
buffer, err := os.ReadFile(string(PROCFS_CPUINFO))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Print(err)
|
log.Print(err)
|
||||||
return nil
|
return nil
|
||||||
@ -108,7 +107,7 @@ func CpuList() []int {
|
|||||||
|
|
||||||
// Get list of CPU core IDs in the order of listing in /proc/cpuinfo
|
// Get list of CPU core IDs in the order of listing in /proc/cpuinfo
|
||||||
func CoreList() []int {
|
func CoreList() []int {
|
||||||
buffer, err := ioutil.ReadFile(string(PROCFS_CPUINFO))
|
buffer, err := os.ReadFile(string(PROCFS_CPUINFO))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Print(err)
|
log.Print(err)
|
||||||
return nil
|
return nil
|
||||||
@ -219,7 +218,7 @@ type HwthreadEntry struct {
|
|||||||
func CpuData() []HwthreadEntry {
|
func CpuData() []HwthreadEntry {
|
||||||
|
|
||||||
// fileToInt := func(path string) int {
|
// fileToInt := func(path string) int {
|
||||||
// buffer, err := ioutil.ReadFile(path)
|
// buffer, err := os.ReadFile(path)
|
||||||
// if err != nil {
|
// if err != nil {
|
||||||
// log.Print(err)
|
// log.Print(err)
|
||||||
// //cclogger.ComponentError("ccTopology", "Reading", path, ":", err.Error())
|
// //cclogger.ComponentError("ccTopology", "Reading", path, ":", err.Error())
|
||||||
@ -248,7 +247,7 @@ func CpuData() []HwthreadEntry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getSMT := func(cpuid int, basepath string) int {
|
getSMT := func(cpuid int, basepath string) int {
|
||||||
buffer, err := ioutil.ReadFile(fmt.Sprintf("%s/thread_siblings_list", basepath))
|
buffer, err := os.ReadFile(fmt.Sprintf("%s/thread_siblings_list", basepath))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cclogger.ComponentError("CCTopology", "CpuData:getSMT", err.Error())
|
cclogger.ComponentError("CCTopology", "CpuData:getSMT", err.Error())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user