diff options
| author | Eng Zer Jun <engzerjun@gmail.com> | 2021-10-14 12:27:58 +0800 |
|---|---|---|
| committer | Eng Zer Jun <engzerjun@gmail.com> | 2021-10-14 12:27:58 +0800 |
| commit | a23bcbb7ecf93fcda35976f4f2fb42a67830e718 (patch) | |
| tree | 3227e82e51346dad8649a17e991c9cf561ef8071 /weed/replication/sub/notification_kafka.go | |
| parent | 4cbd390fbe634e2370c36a61b1574e9d648c3cee (diff) | |
| download | seaweedfs-a23bcbb7ecf93fcda35976f4f2fb42a67830e718.tar.xz seaweedfs-a23bcbb7ecf93fcda35976f4f2fb42a67830e718.zip | |
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>
Diffstat (limited to 'weed/replication/sub/notification_kafka.go')
| -rw-r--r-- | weed/replication/sub/notification_kafka.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/weed/replication/sub/notification_kafka.go b/weed/replication/sub/notification_kafka.go index 622a759ea..41a4caaf3 100644 --- a/weed/replication/sub/notification_kafka.go +++ b/weed/replication/sub/notification_kafka.go @@ -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) } |
