Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing deprecated ioutil #170

Merged
merged 7 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ jobs:
name: Image Scanner
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.20+
- name: Set up Go 1.21+
uses: actions/setup-go@v4
with:
go-version: ^1.20
go-version: ^1.21
cache: false
id: go
- name: Checkout the code
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
steps:
- uses: actions/setup-go@v4
with:
go-version: "1.20"
go-version: "1.21"
cache: false
- name: Checkout the code
uses: actions/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module podmon

go 1.20
go 1.21

require (
github.com/bramvdbogaerde/go-scp v0.0.0-20201229172121-7a6c0268fa67
Expand Down
3 changes: 1 addition & 2 deletions internal/monitor/integration_steps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package monitor
import (
"context"
"fmt"
"io/ioutil"
"math"
"os"
"os/exec"
Expand Down Expand Up @@ -1091,7 +1090,7 @@ func (i *integration) copyOverTestScriptsToNode(address string) error {
return mkDirErr
}

files, err := ioutil.ReadDir(i.scriptsDir)
files, err := os.ReadDir(i.scriptsDir)
if err != nil {
return err
}
Expand Down
5 changes: 2 additions & 3 deletions internal/monitor/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"context"
"errors"
"fmt"
"io/ioutil"
"os"
"podmon/internal/criapi"
"podmon/internal/k8sapi"
Expand Down Expand Up @@ -178,7 +177,7 @@ func (pm *PodMonitorType) nodeModePodHandler(pod *v1.Pod, eventType watch.EventT
// Scan for mounts
csiVolumesPath := fmt.Sprintf(CSIVolumePathFormat, string(pod.ObjectMeta.UID))
log.Debugf("csiVolumesPath: %s", csiVolumesPath)
volumeEntries, err := ioutil.ReadDir(csiVolumesPath)
volumeEntries, err := os.ReadDir(csiVolumesPath)
if err != nil && !os.IsNotExist(err) {
log.WithFields(fields).Errorf("Couldn't read directory %s: %s", csiVolumesPath, err.Error())
return err
Expand Down Expand Up @@ -206,7 +205,7 @@ func (pm *PodMonitorType) nodeModePodHandler(pod *v1.Pod, eventType watch.EventT
// Scan for block devices
csiDevicesPath := fmt.Sprintf(CSIDevicePathFormat, string(pod.ObjectMeta.UID))
log.Infof("csiDevicesPath: %s", csiDevicesPath)
deviceEntries, err := ioutil.ReadDir(csiDevicesPath)
deviceEntries, err := os.ReadDir(csiDevicesPath)
if err != nil && !os.IsNotExist(err) {
log.WithFields(fields).Errorf("Couldn't read directory %s: %s", csiDevicesPath, err.Error())
return err
Expand Down
5 changes: 2 additions & 3 deletions test/podmontest/podmontest.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"crypto/rand"
"flag"
"fmt"
"io/ioutil"
"os"
"strings"
"time"
Expand Down Expand Up @@ -66,7 +65,7 @@ func readExistingEntries(rootDir string) bool {
reportedOtherKeys := make(map[string]bool)
initialPod := true

entries, err := ioutil.ReadDir(rootDir)
entries, err := os.ReadDir(rootDir)
if err != nil {
fmt.Printf("Couldn't read %s\n", rootDir)
return true
Expand Down Expand Up @@ -136,7 +135,7 @@ var counter int

func makeEntry(podTag, rootDir string, index int, initialPod bool) {
tag := fmt.Sprintf("%x %s\n", podTag, time.Now().Format(time.Stamp))
entries, err := ioutil.ReadDir(rootDir)
entries, err := os.ReadDir(rootDir)
if err != nil {
fmt.Printf("Couldn't read %s\n", rootDir)
return
Expand Down
Loading