mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-03-05 20:49:04 -08:00
refactor: remove io/ioutil
io/ioutil has been deprected since go 1.16 https://pkg.go.dev/io/ioutil Signed-off-by: ginglis13 <ginglis05@gmail.com>
This commit is contained in:
parent
fb5744985b
commit
eef39eff77
|
@ -1,7 +1,6 @@
|
|||
package engine
|
||||
|
||||
import (
|
||||
"io/ioutil" //nolint:staticcheck,nolintlint
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
@ -29,7 +28,7 @@ var cases = []struct {
|
|||
|
||||
func runImageTest(config, content string) (string, error) {
|
||||
poshImagePath := "jandedobbeleer.png"
|
||||
file, err := ioutil.TempFile("", poshImagePath)
|
||||
file, err := os.CreateTemp("", poshImagePath)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
package font
|
||||
|
||||
import (
|
||||
"io/ioutil" //nolint:staticcheck,nolintlint
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
|
@ -27,5 +26,5 @@ func install(font *Font, _ bool) error {
|
|||
return err
|
||||
}
|
||||
|
||||
return ioutil.WriteFile(fullPath, font.Data, 0644)
|
||||
return os.WriteFile(fullPath, font.Data, 0644)
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ package battery
|
|||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil" //nolint:staticcheck,nolintlint
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
|
@ -43,7 +42,7 @@ func newState(name string) (State, error) {
|
|||
}
|
||||
|
||||
func readFloat(path, filename string) (float64, error) {
|
||||
str, err := ioutil.ReadFile(filepath.Join(path, filename))
|
||||
str, err := os.ReadFile(filepath.Join(path, filename))
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
@ -66,12 +65,12 @@ func readAmp(path, filename string, volts float64) (float64, error) {
|
|||
}
|
||||
|
||||
func isBattery(path string) bool {
|
||||
t, err := ioutil.ReadFile(filepath.Join(path, "type"))
|
||||
t, err := os.ReadFile(filepath.Join(path, "type"))
|
||||
return err == nil && string(t) == "Battery\n"
|
||||
}
|
||||
|
||||
func getBatteryFiles() ([]string, error) {
|
||||
files, err := ioutil.ReadDir(sysfs)
|
||||
files, err := os.ReadDir(sysfs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -119,7 +118,7 @@ func getByPath(path string) (*battery, error) {
|
|||
}
|
||||
}
|
||||
|
||||
state, err := ioutil.ReadFile(filepath.Join(path, "status"))
|
||||
state, err := os.ReadFile(filepath.Join(path, "status"))
|
||||
if err != nil || len(state) == 0 {
|
||||
return nil, errors.New("unable to parse or invalid status")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue