Skip to content

Commit ddecfba

Browse files
authored
Merge pull request #51 from SLH335/fix-deprecated
chore: update deprecated ioutil function calls
2 parents a273c50 + 33a9b1b commit ddecfba

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"context"
55
"encoding/json"
66
"flag"
7-
"io/ioutil"
7+
"io"
88
_log "log"
99
"os"
1010

@@ -36,7 +36,7 @@ type tConfig struct {
3636
}
3737

3838
func init() {
39-
_log.SetOutput(ioutil.Discard)
39+
_log.SetOutput(io.Discard)
4040

4141
log.SetFormatter(&log.TextFormatter{DisableTimestamp: true})
4242
log.SetOutput(os.Stdout)
@@ -60,7 +60,7 @@ func main() {
6060
log.SetFormatter(&log.TextFormatter{DisableTimestamp: true})
6161
log.SetOutput(os.Stdout)
6262

63-
content, err := ioutil.ReadFile(configFile)
63+
content, err := os.ReadFile(configFile)
6464
if err != nil {
6565
log.Fatal(err.Error())
6666
}

plugin.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"errors"
66
"fmt"
7-
"io/ioutil"
87
"os"
98
"os/exec"
109
"path/filepath"
@@ -46,7 +45,7 @@ func newPlugin(provider *gophercloud.ProviderClient, endpointOpts gophercloud.En
4645
}
4746

4847
if len(config.MachineID) == 0 {
49-
bytes, err := ioutil.ReadFile("/etc/machine-id")
48+
bytes, err := os.ReadFile("/etc/machine-id")
5049
if err != nil {
5150
log.WithError(err).Error("Error reading machine id")
5251
return nil, err
@@ -346,7 +345,7 @@ func (d plugin) Unmount(r *volume.UnmountRequest) error {
346345
path := filepath.Join(d.config.MountDir, r.Name)
347346
exists, err := isDirectoryPresent(path)
348347
if err != nil {
349-
logger.WithError(err).Error("Error checking directory stat: %s", path)
348+
logger.WithError(err).Errorf("Error checking directory stat: %s", path)
350349
}
351350

352351
if exists {

0 commit comments

Comments
 (0)