Skip to content
This repository was 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
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
chore: remove refs to deprecated io/ioutil
Signed-off-by: guoguangwu <guoguangwu@magic-shield.com>
  • Loading branch information
testwill committed Oct 12, 2023
commit a7dfe66ed52912a8597fcc2026a7704c4ec44681
5 changes: 2 additions & 3 deletions cmd/test/main.go
Original file line number Diff line number Diff line change
@@ -3,7 +3,6 @@ package test
import (
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"reflect"
@@ -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
}
@@ -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 {
3 changes: 1 addition & 2 deletions pkg/defaultRules/defaultRules.go
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@ package defaultRules

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

@@ -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
}