Replace ioutil with os
This commit is contained in:
parent
cbc1f161c1
commit
2b1dd61ecc
1 changed files with 2 additions and 3 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue