~jcc/swaybar-commander

6f457d62098c6b89375b39965061e3b1340e5cdf — Jason Cox 4 months ago e413e5f
Replace deprecated function calls
2 files changed, 2 insertions(+), 4 deletions(-)

M commands/runtime.go
M config/config.go
M commands/runtime.go => commands/runtime.go +1 -2
@@ 3,7 3,6 @@ package commands
import (
	"encoding/json"
	"fmt"
	"io/ioutil"
	"os"
	"regexp"
	"strconv"


@@ 68,7 67,7 @@ func readRuntimeFile(path string) (*os.Process, []blockRuntime, error) {
		return nil, nil, nil
	}

	runtimeJson, err := ioutil.ReadFile(path)
	runtimeJson, err := os.ReadFile(path)
	if err != nil {
		return nil, nil, fmt.Errorf("failed to read runtime file %s: %v", path, err)
	}

M config/config.go => config/config.go +1 -2
@@ 4,7 4,6 @@ package config
import (
	"errors"
	"fmt"
	"io/ioutil"
	"os"

	"git.sr.ht/~jcc/swaybar-commander/proto"


@@ 25,7 24,7 @@ type Block struct {
	PollSecs           int
}

var readFile = ioutil.ReadFile // allow mocking in tests
var readFile = os.ReadFile // allow mocking in tests

// Load reads the config file, validates it, populates defaults as needed, and
// returns the parsed configuration.