diff --git a/pgconn/config.go b/pgconn/config.go index 6282f41b..005d3fe2 100644 --- a/pgconn/config.go +++ b/pgconn/config.go @@ -8,7 +8,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "math" "net" "net/url" @@ -687,7 +686,7 @@ func configTLS(settings map[string]string, thisHost string, parseConfigOptions P caCertPool := x509.NewCertPool() caPath := sslrootcert - caCert, err := ioutil.ReadFile(caPath) + caCert, err := os.ReadFile(caPath) if err != nil { return nil, fmt.Errorf("unable to read CA file: %w", err) } @@ -705,7 +704,7 @@ func configTLS(settings map[string]string, thisHost string, parseConfigOptions P } if sslcert != "" && sslkey != "" { - buf, err := ioutil.ReadFile(sslkey) + buf, err := os.ReadFile(sslkey) if err != nil { return nil, fmt.Errorf("unable to read sslkey: %w", err) } @@ -744,7 +743,7 @@ func configTLS(settings map[string]string, thisHost string, parseConfigOptions P } else { pemKey = pem.EncodeToMemory(block) } - certfile, err := ioutil.ReadFile(sslcert) + certfile, err := os.ReadFile(sslcert) if err != nil { return nil, fmt.Errorf("unable to read cert: %w", err) } diff --git a/pgconn/config_test.go b/pgconn/config_test.go index ff5c8a76..963455f7 100644 --- a/pgconn/config_test.go +++ b/pgconn/config_test.go @@ -4,7 +4,6 @@ import ( "context" "crypto/tls" "fmt" - "io/ioutil" "os" "os/user" "runtime" @@ -1031,7 +1030,7 @@ func TestParseConfigEnvLibpq(t *testing.T) { func TestParseConfigReadsPgPassfile(t *testing.T) { t.Parallel() - tf, err := ioutil.TempFile("", "") + tf, err := os.CreateTemp("", "") require.NoError(t, err) defer tf.Close() @@ -1060,7 +1059,7 @@ func TestParseConfigReadsPgPassfile(t *testing.T) { func TestParseConfigReadsPgServiceFile(t *testing.T) { t.Parallel() - tf, err := ioutil.TempFile("", "") + tf, err := os.CreateTemp("", "") require.NoError(t, err) defer tf.Close() diff --git a/pgconn/pgconn_test.go b/pgconn/pgconn_test.go index 3b1ce436..0a2240a1 100644 --- a/pgconn/pgconn_test.go +++ b/pgconn/pgconn_test.go @@ -8,7 +8,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "log" "math" "net" @@ -1819,7 +1818,7 @@ func TestConnCopyFromGzipReader(t *testing.T) { )`).ReadAll() require.NoError(t, err) - f, err := ioutil.TempFile("", "*") + f, err := os.CreateTemp("", "*") require.NoError(t, err) gw := gzip.NewWriter(f)