mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-19 05:49:56 +08:00
refactor: move from io/ioutil to io and os package
The io/ioutil package has been deprecated as of Go 1.16, see https://golang.org/doc/go1.16#ioutil. This commit replaces the existing io/ioutil functions with their new definitions in io and os packages. Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
@@ -3,7 +3,7 @@ package sub
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -119,7 +119,7 @@ type KafkaProgress struct {
|
||||
|
||||
func loadProgress(offsetFile string) *KafkaProgress {
|
||||
progress := &KafkaProgress{}
|
||||
data, err := ioutil.ReadFile(offsetFile)
|
||||
data, err := os.ReadFile(offsetFile)
|
||||
if err != nil {
|
||||
glog.Warningf("failed to read kafka progress file: %s", offsetFile)
|
||||
return nil
|
||||
@@ -137,7 +137,7 @@ func (progress *KafkaProgress) saveProgress() error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to marshal progress: %v", err)
|
||||
}
|
||||
err = ioutil.WriteFile(progress.offsetFile, data, 0640)
|
||||
err = os.WriteFile(progress.offsetFile, data, 0640)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to save progress to %s: %v", progress.offsetFile, err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user