Replace ioutil with os

This commit is contained in:
Søren Rasmussen 2024-06-15 21:37:00 +02:00
parent cbc1f161c1
commit 2b1dd61ecc

View file

@ -6,7 +6,6 @@ import (
"context"
"errors"
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
@ -225,7 +224,7 @@ func triggerBulkRead() error {
}
func pollBusState() (BulkReadBusState, error) {
b, err := ioutil.ReadFile("/sys/bus/w1/devices/w1_bus_master1/therm_bulk_read")
b, err := os.ReadFile("/sys/bus/w1/devices/w1_bus_master1/therm_bulk_read")
if err != nil {
return BulkReadIdle, err
}
@ -241,7 +240,7 @@ func pollBusState() (BulkReadBusState, error) {
// read returns the temperature of the specified sensor in millidegrees celcius.
func read(sensor string) (int64, error) {
path := filepath.Join("/sys/bus/w1/devices", sensor, "w1_slave")
data, err := ioutil.ReadFile(path)
data, err := os.ReadFile(path)
if err != nil {
return NaN, err
}