From 286c8961924a11102b6f9eeb7f522279d840a30b Mon Sep 17 00:00:00 2001 From: "fengyun.rui" Date: Thu, 7 Dec 2023 12:58:12 +0800 Subject: [PATCH] fix: replace ioutil.readfile with os.readfile (#868) ### summay `ioutil.ReadFile` is Deprecated, As of Go 1.16, this function simply calls [os.ReadFile]. Signed-off-by: rfyiamcool --- examples/filewatch/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/filewatch/main.go b/examples/filewatch/main.go index ddb613c..a088092 100644 --- a/examples/filewatch/main.go +++ b/examples/filewatch/main.go @@ -7,7 +7,6 @@ package main import ( "flag" "html/template" - "io/ioutil" "log" "net/http" "os" @@ -50,7 +49,8 @@ func readFileIfModified(lastMod time.Time) ([]byte, time.Time, error) { if !fi.ModTime().After(lastMod) { return nil, lastMod, nil } - p, err := ioutil.ReadFile(filepath.Clean(filename)) + + p, err := os.ReadFile(filepath.Clean(filename)) if err != nil { return nil, fi.ModTime(), err }