From fa95a01da8f0685df9df735b5b495f306b6b519b Mon Sep 17 00:00:00 2001 From: Vladimir Mihailenco Date: Wed, 24 May 2023 13:40:08 +0300 Subject: [PATCH] chore: don't use deprecated ioutil --- driver/pgdriver/config.go | 3 +-- migrate/migrator.go | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/driver/pgdriver/config.go b/driver/pgdriver/config.go index 27f378042..b58d0227c 100644 --- a/driver/pgdriver/config.go +++ b/driver/pgdriver/config.go @@ -6,7 +6,6 @@ import ( "crypto/x509" "errors" "fmt" - "io/ioutil" "net" "net/url" "os" @@ -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) } diff --git a/migrate/migrator.go b/migrate/migrator.go index 5cae6ccb9..ddf5485c0 100644 --- a/migrate/migrator.go +++ b/migrate/migrator.go @@ -4,7 +4,7 @@ import ( "context" "errors" "fmt" - "io/ioutil" + "os" "path/filepath" "regexp" "time" @@ -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 } @@ -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 }