Skip to content

Commit 1096ef9

Browse files
author
root
committed
chore: replace ioutil with io/os
1 parent 0083edb commit 1096ef9

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

config/configs.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package config
33
import (
44
"encoding/xml"
55
"errors"
6-
"io/ioutil"
6+
"os"
77

88
"github.com/devfeel/dotweb/core"
99
"github.com/devfeel/dotweb/framework/file"
@@ -265,7 +265,7 @@ func dealConfigDefaultSet(c *Config) {
265265
}
266266

267267
func initConfig(configFile string, ctType string, parser func([]byte, interface{}) error) (*Config, error) {
268-
content, err := ioutil.ReadFile(configFile)
268+
content, err := os.ReadFile(configFile)
269269
if err != nil {
270270
return nil, errors.New("DotWeb:Config:initConfig current cType:" + ctType + " config file [" + configFile + "] cannot be parsed - " + err.Error())
271271
}

config/configset.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package config
33
import (
44
"encoding/xml"
55
"errors"
6-
"io/ioutil"
6+
"os"
77

88
"github.com/devfeel/dotweb/core"
99
)
@@ -39,7 +39,7 @@ func ParseConfigSetYaml(configFile string) (core.ConcurrenceMap, error) {
3939
}
4040

4141
func parseConfigSetFile(configFile string, confType string) (core.ConcurrenceMap, error) {
42-
content, err := ioutil.ReadFile(configFile)
42+
content, err := os.ReadFile(configFile)
4343
if err != nil {
4444
return nil, errors.New("DotWeb:Config:parseConfigSetFile 配置文件[" + configFile + ", " + confType + "]无法解析 - " + err.Error())
4545
}

request.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package dotweb
22

33
import (
4-
"io/ioutil"
4+
"io"
55
"net"
66
"net/http"
77
"net/url"
@@ -162,7 +162,7 @@ func (req *Request) PostBody() []byte {
162162
break
163163
}
164164
}
165-
bts, err := ioutil.ReadAll(req.Body)
165+
bts, err := io.ReadAll(req.Body)
166166
if err != nil {
167167
//if err, panic it
168168
panic(err)

0 commit comments

Comments
 (0)