Skip to content
Closed
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
8 changes: 4 additions & 4 deletions cmd/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cmd
import (
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"os"
"path/filepath"
Expand Down Expand Up @@ -43,7 +43,7 @@ func processDocuments(cache *sync.Map, configs libraryapiv1.Configs) error {
}

// Read the YAML file
contents, err := ioutil.ReadFile(fmt.Sprintf("%s.yaml", document))
contents, err := os.ReadFile(fmt.Sprintf("%s.yaml", document))
if err != nil {
klog.Errorf("[Doc: %s] unable to read specified file: %v", document, err)
os.Exit(1)
Expand Down Expand Up @@ -130,7 +130,7 @@ func writeToFile(config int, document string, data []byte, filePath string) erro
return fmt.Errorf("Error creating directory %q: %v", filepath.Dir(filePath), err)
}
}
return ioutil.WriteFile(filePath, data, os.ModePerm)
return os.WriteFile(filePath, data, os.ModePerm)
}

func replaceVariables(document string, d *[]byte, v map[string]string) error {
Expand All @@ -156,7 +156,7 @@ func fetchURL(cache *sync.Map, path string) ([]byte, error) {
if resp.StatusCode != 200 {
return []byte{}, fmt.Errorf("%d", resp.StatusCode)
}
body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
return nil, err
}
Expand Down
3 changes: 1 addition & 2 deletions cmd/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"os"
"path"
"reflect"
Expand Down Expand Up @@ -73,7 +72,7 @@ var importCmd = &cobra.Command{
klog.Errorf("the configuration file specified does not exist: %v", err)
os.Exit(1)
}
c, err := ioutil.ReadFile(config)
c, err := os.ReadFile(config)
if err != nil {
klog.Errorf("[%s] unable to read configuration file: %v", config, err)
os.Exit(1)
Expand Down