Skip to content

Commit

Permalink
Merge pull request #51 from SLH335/fix-deprecated
Browse files Browse the repository at this point in the history
chore: update deprecated ioutil function calls
  • Loading branch information
jgraichen authored Jan 9, 2025
2 parents a273c50 + 33a9b1b commit ddecfba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"encoding/json"
"flag"
"io/ioutil"
"io"
_log "log"
"os"

Expand Down Expand Up @@ -36,7 +36,7 @@ type tConfig struct {
}

func init() {
_log.SetOutput(ioutil.Discard)
_log.SetOutput(io.Discard)

log.SetFormatter(&log.TextFormatter{DisableTimestamp: true})
log.SetOutput(os.Stdout)
Expand All @@ -60,7 +60,7 @@ func main() {
log.SetFormatter(&log.TextFormatter{DisableTimestamp: true})
log.SetOutput(os.Stdout)

content, err := ioutil.ReadFile(configFile)
content, err := os.ReadFile(configFile)
if err != nil {
log.Fatal(err.Error())
}
Expand Down
5 changes: 2 additions & 3 deletions plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"errors"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
Expand Down Expand Up @@ -46,7 +45,7 @@ func newPlugin(provider *gophercloud.ProviderClient, endpointOpts gophercloud.En
}

if len(config.MachineID) == 0 {
bytes, err := ioutil.ReadFile("/etc/machine-id")
bytes, err := os.ReadFile("/etc/machine-id")
if err != nil {
log.WithError(err).Error("Error reading machine id")
return nil, err
Expand Down Expand Up @@ -346,7 +345,7 @@ func (d plugin) Unmount(r *volume.UnmountRequest) error {
path := filepath.Join(d.config.MountDir, r.Name)
exists, err := isDirectoryPresent(path)
if err != nil {
logger.WithError(err).Error("Error checking directory stat: %s", path)
logger.WithError(err).Errorf("Error checking directory stat: %s", path)
}

if exists {
Expand Down

0 comments on commit ddecfba

Please sign in to comment.