mirror of https://github.com/gorilla/websocket.git
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 <rfyiamcool@163.com>
This commit is contained in:
parent
6f5d2139f4
commit
286c896192
|
@ -7,7 +7,6 @@ package main
|
||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
"html/template"
|
"html/template"
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
@ -50,7 +49,8 @@ func readFileIfModified(lastMod time.Time) ([]byte, time.Time, error) {
|
||||||
if !fi.ModTime().After(lastMod) {
|
if !fi.ModTime().After(lastMod) {
|
||||||
return nil, lastMod, nil
|
return nil, lastMod, nil
|
||||||
}
|
}
|
||||||
p, err := ioutil.ReadFile(filepath.Clean(filename))
|
|
||||||
|
p, err := os.ReadFile(filepath.Clean(filename))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fi.ModTime(), err
|
return nil, fi.ModTime(), err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue