diff --git a/web/handler.go b/web/handler.go index 0dcae25..fe633d1 100644 --- a/web/handler.go +++ b/web/handler.go @@ -11,6 +11,7 @@ import ( "github.com/karldoenitz/Tigo/logger" "gorm.io/gorm" "html/template" + "io" "io/ioutil" "net/http" "net/http/httputil" @@ -42,7 +43,7 @@ func (baseHandler *BaseHandler) InitHandler(responseWriter http.ResponseWriter, // GetBody 获取HTTP报文体 func (baseHandler *BaseHandler) GetBody() []byte { if _, ok := baseHandler.ctxValMap["body"]; !ok { - body, err := ioutil.ReadAll(baseHandler.Request.Body) + body, err := io.ReadAll(baseHandler.Request.Body) if err != nil { logger.Error.Println(err.Error()) return nil diff --git a/web/struct.go b/web/struct.go index 2c9bcd7..9a0b06e 100644 --- a/web/struct.go +++ b/web/struct.go @@ -5,7 +5,6 @@ import ( "fmt" "github.com/karldoenitz/Tigo/logger" "gopkg.in/yaml.v2" - "io/ioutil" "net/http" "os" "reflect" @@ -165,7 +164,7 @@ func (globalConfig *GlobalConfig) Init(configPath string) { // 根据yaml文件进行配置 func (globalConfig *GlobalConfig) initWithYaml(configPath string) { - raw, err := ioutil.ReadFile(configPath) + raw, err := os.ReadFile(configPath) if err != nil { fmt.Println(err.Error()) os.Exit(1) @@ -180,7 +179,7 @@ func (globalConfig *GlobalConfig) initWithYaml(configPath string) { // 根据json文件进行配置 func (globalConfig *GlobalConfig) initWithJson(configPath string) { - raw, err := ioutil.ReadFile(configPath) + raw, err := os.ReadFile(configPath) if err != nil { fmt.Println(err.Error()) os.Exit(1)