mirror of
https://blitiri.com.ar/repos/chasquid
synced 2026-01-05 17:37:03 +00:00
Replace uses of ioutil
ioutil package was deprecated in Go 1.16, replace all uses with their respective replacements. This patch was generated with a combination of `gofmt -r`, `eg`, and manually (for `ioutil.ReadDir`).
This commit is contained in:
@@ -6,7 +6,6 @@ package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"blitiri.com.ar/go/log"
|
||||
@@ -39,7 +38,7 @@ func Load(path, overrides string) (*Config, error) {
|
||||
c := proto.Clone(defaultConfig).(*Config)
|
||||
|
||||
// Load from the path.
|
||||
buf, err := ioutil.ReadFile(path)
|
||||
buf, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to read config at %q: %v", path, err)
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package config
|
||||
|
||||
import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
@@ -16,7 +15,7 @@ import (
|
||||
func mustCreateConfig(t *testing.T, contents string) (string, string) {
|
||||
tmpDir := testlib.MustTempDir(t)
|
||||
confStr := []byte(contents)
|
||||
err := ioutil.WriteFile(tmpDir+"/chasquid.conf", confStr, 0600)
|
||||
err := os.WriteFile(tmpDir+"/chasquid.conf", confStr, 0600)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to write tmp config: %v", err)
|
||||
}
|
||||
@@ -138,7 +137,7 @@ func TestBrokenOverride(t *testing.T) {
|
||||
// Run LogConfig, overriding the default logger first. This exercises the
|
||||
// code, we don't yet validate the output, but it is an useful sanity check.
|
||||
func testLogConfig(c *Config) {
|
||||
l := log.New(nopWCloser{ioutil.Discard})
|
||||
l := log.New(nopWCloser{io.Discard})
|
||||
log.Default = l
|
||||
LogConfig(c)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user