SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
Updated the deprecated ioutil dependency (#4239)
Zachary Waltersef2f741823bd
diff --git a/weed/command/update.go b/weed/command/update.goindex 70a075f803..314a903f2c 100644--- a/weed/command/update.go+++ b/weed/command/update.go@@ -11,7 +11,6 @@ import ("encoding/json""fmt""io"- "io/ioutil""net/http""os""path/filepath"@@ -215,7 +214,7 @@ func GitHubLatestRelease(ctx context.Context, ver string, owner, repo string) (Rreturn Release{}, fmt.Errorf("unexpected status %v (%v) returned", res.StatusCode, res.Status)}- buf, err := ioutil.ReadAll(res.Body)+ buf, err := io.ReadAll(res.Body)if err != nil {return Release{}, err}@@ -265,7 +264,7 @@ func getGithubData(ctx context.Context, url string) ([]byte, error) {return nil, fmt.Errorf("unexpected status %v (%v) returned", res.StatusCode, res.Status)}- buf, err := ioutil.ReadAll(res.Body)+ buf, err := io.ReadAll(res.Body)if err != nil {return nil, err}@@ -337,7 +336,7 @@ func extractToFile(buf []byte, filename, target string) error {// Write everything to a temp filedir := filepath.Dir(target)- new, err := ioutil.TempFile(dir, "weed")+ new, err := os.CreateTemp(dir, "weed")if err != nil {return err}diff --git a/weed/security/tls.go b/weed/security/tls.goindex e20b324374..d5384fc51a 100644--- a/weed/security/tls.go+++ b/weed/security/tls.go@@ -7,7 +7,7 @@ import ("google.golang.org/grpc/credentials/insecure""google.golang.org/grpc/credentials/tls/certprovider/pemfile""google.golang.org/grpc/security/advancedtls"- "io/ioutil"+ "os""strings""time"@@ -136,7 +136,7 @@ func LoadClientTLS(config *util.ViperProxy, component string) grpc.DialOption {}func LoadClientTLSHTTP(clientCertFile string) *tls.Config {- clientCerts, err := ioutil.ReadFile(clientCertFile)+ clientCerts, err := os.ReadFile(clientCertFile)if err != nil {glog.Fatal(err)}diff --git a/weed/server/raft_server.go b/weed/server/raft_server.goindex 0e184308d7..d718ecac72 100644--- a/weed/server/raft_server.go+++ b/weed/server/raft_server.go@@ -4,7 +4,6 @@ import ("encoding/json"transport "github.com/Jille/raft-grpc-transport""io"- "io/ioutil""math/rand""os""path"@@ -90,7 +89,7 @@ func (s *StateMachine) Snapshot() (hashicorpRaft.FSMSnapshot, error) {}func (s *StateMachine) Restore(r io.ReadCloser) error {- b, err := ioutil.ReadAll(r)+ b, err := io.ReadAll(r)if err != nil {return err}diff --git a/weed/shell/command_volume_fsck.go b/weed/shell/command_volume_fsck.goindex 02956e9cab..5559be9566 100644--- a/weed/shell/command_volume_fsck.go+++ b/weed/shell/command_volume_fsck.go@@ -20,7 +20,6 @@ import ("github.com/seaweedfs/seaweedfs/weed/storage/types""github.com/seaweedfs/seaweedfs/weed/util""io"- "io/ioutil""math""net/http""net/url"@@ -409,7 +408,7 @@ func (c *commandVolumeFsck) collectOneVolumeFileIds(dataNodeId string, volumeId}buf.Write(resp.FileContent)}- if vinfo.isReadOnly == false {+ if !vinfo.isReadOnly {index, err := idx.FirstInvalidIndex(buf.Bytes(),func(key types.NeedleId, offset types.Offset, size types.Size) (bool, error) {resp, err := volumeServerClient.ReadNeedleMeta(context.Background(), &volume_server_pb.ReadNeedleMetaRequest{@@ -535,7 +534,7 @@ func (c *commandVolumeFsck) httpDelete(path util.FullPath) {}defer resp.Body.Close()- _, err = ioutil.ReadAll(resp.Body)+ _, err = io.ReadAll(resp.Body)if err != nil {fmt.Fprintf(c.writer, "DELETE response error: %v\n", err)}