Skip to content

Commit

Permalink
chore: don't use deprecated ioutil
Browse files Browse the repository at this point in the history
  • Loading branch information
vmihailenco committed May 24, 2023
1 parent 0a2eade commit fa95a01
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions driver/pgdriver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"crypto/x509"
"errors"
"fmt"
"io/ioutil"
"net"
"net/url"
"os"
Expand Down Expand Up @@ -312,7 +311,7 @@ func parseDSN(dsn string) ([]Option, error) {
return nil, fmt.Errorf("pgdriver: sslmode '%s' is not supported", sslMode)
}
if tlsConfig != nil && sslRootCert != "" {
rawCA, err := ioutil.ReadFile(sslRootCert)
rawCA, err := os.ReadFile(sslRootCert)
if err != nil {
return nil, fmt.Errorf("pgdriver: failed to read root CA: %w", err)
}
Expand Down
6 changes: 3 additions & 3 deletions migrate/migrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"errors"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"regexp"
"time"
Expand Down Expand Up @@ -255,7 +255,7 @@ func (m *Migrator) CreateGoMigration(
fpath := filepath.Join(m.migrations.getDirectory(), fname)
content := fmt.Sprintf(cfg.goTemplate, cfg.packageName)

if err := ioutil.WriteFile(fpath, []byte(content), 0o644); err != nil {
if err := os.WriteFile(fpath, []byte(content), 0o644); err != nil {
return nil, err
}

Expand Down Expand Up @@ -290,7 +290,7 @@ func (m *Migrator) CreateSQLMigrations(ctx context.Context, name string) ([]*Mig
func (m *Migrator) createSQL(ctx context.Context, fname string) (*MigrationFile, error) {
fpath := filepath.Join(m.migrations.getDirectory(), fname)

if err := ioutil.WriteFile(fpath, []byte(sqlTemplate), 0o644); err != nil {
if err := os.WriteFile(fpath, []byte(sqlTemplate), 0o644); err != nil {
return nil, err
}

Expand Down

0 comments on commit fa95a01

Please sign in to comment.