mirror of
https://github.com/packwiz/packwiz.git
synced 2025-10-23 09:24:32 +02:00
Fix deprecated uses of ioutil
This commit is contained in:
@@ -8,7 +8,6 @@ import (
|
||||
"fmt"
|
||||
"github.com/packwiz/packwiz/curseforge/packinterop"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
@@ -97,7 +96,7 @@ var importCmd = &cobra.Command{
|
||||
// Check if file is a zip
|
||||
if string(header) == "PK" {
|
||||
// Read the whole file (as bufio doesn't work for zips)
|
||||
zipData, err := ioutil.ReadAll(buf)
|
||||
zipData, err := io.ReadAll(buf)
|
||||
if err != nil {
|
||||
fmt.Printf("Error reading file: %s\n", err)
|
||||
os.Exit(1)
|
||||
@@ -142,7 +141,7 @@ var importCmd = &cobra.Command{
|
||||
_, err = os.Stat(indexFilePath)
|
||||
if os.IsNotExist(err) {
|
||||
// Create file
|
||||
err = ioutil.WriteFile(indexFilePath, []byte{}, 0644)
|
||||
err = os.WriteFile(indexFilePath, []byte{}, 0644)
|
||||
if err != nil {
|
||||
fmt.Printf("Error creating index file: %s\n", err)
|
||||
os.Exit(1)
|
||||
|
@@ -3,7 +3,6 @@ package packinterop
|
||||
import (
|
||||
"bufio"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
@@ -68,7 +67,7 @@ func (s diskPackSource) GetFileList() ([]ImportPackFile, error) {
|
||||
}
|
||||
|
||||
func (s diskPackSource) GetPackFile() ImportPackFile {
|
||||
rc := ioutil.NopCloser(s.MetaSource)
|
||||
rc := io.NopCloser(s.MetaSource)
|
||||
return readerFile{s.MetaName, &rc}
|
||||
}
|
||||
|
||||
|
@@ -6,7 +6,6 @@ import (
|
||||
"fmt"
|
||||
"github.com/packwiz/packwiz/core"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
)
|
||||
|
||||
@@ -20,7 +19,7 @@ func ReadMetadata(s ImportPackSource) ImportPackMetadata {
|
||||
}
|
||||
|
||||
// Read the whole file (as we are going to parse it multiple times)
|
||||
fileData, err := ioutil.ReadAll(rdr)
|
||||
fileData, err := io.ReadAll(rdr)
|
||||
if err != nil {
|
||||
fmt.Printf("Error reading file: %s\n", err)
|
||||
os.Exit(1)
|
||||
|
Reference in New Issue
Block a user