Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

chore: remove refs to deprecated io/ioutil #969

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions cmd/test/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package test
import (
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"reflect"
Expand Down Expand Up @@ -495,7 +494,7 @@ func test(ctx *TestCommandContext, paths []string, testCommandData *TestCommandD
return err
}

err = ioutil.WriteFile(testCommandData.SaveResults, []byte(resultsText), 0666)
err = os.WriteFile(testCommandData.SaveResults, []byte(resultsText), 0666)
if err != nil {
return err
}
Expand Down Expand Up @@ -705,7 +704,7 @@ func saveDefaultRulesAsFile(ctx *TestCommandContext, preRunDefaultRulesYaml stri
defaultRulesFilePath := filepath.Join(homeDir, ".datree", "defaultRules.yaml")

const fileReadPermission = 0644
_ = ioutil.WriteFile(defaultRulesFilePath, []byte(preRunDefaultRulesYaml), os.FileMode(fileReadPermission))
_ = os.WriteFile(defaultRulesFilePath, []byte(preRunDefaultRulesYaml), os.FileMode(fileReadPermission))
}

func shouldDisplaySpinner(IsCI bool, isInteractiveMode bool, outputOption string) bool {
Expand Down
3 changes: 1 addition & 2 deletions pkg/defaultRules/defaultRules.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package defaultRules

import (
_ "embed"
"io/ioutil"
"os"
"path/filepath"

Expand Down Expand Up @@ -51,6 +50,6 @@ func getDefaultRulesFromFile() (string, error) {
if err != nil {
return "", err
}
defaultRulesFileContent, err := ioutil.ReadFile(filepath.Join(homeDir, ".datree", "defaultRules.yaml"))
defaultRulesFileContent, err := os.ReadFile(filepath.Join(homeDir, ".datree", "defaultRules.yaml"))
return string(defaultRulesFileContent), err
}