feat(升级依赖): 升级依赖并去掉废弃函数

This commit is contained in:
xiaoqidun 2023-04-07 15:32:15 +08:00
parent afe166ae6e
commit 01491ac5e0
3 changed files with 7 additions and 6 deletions

2
go.mod
View File

@ -2,4 +2,4 @@ module github.com/xiaoqidun/qqwry
go 1.20
require golang.org/x/text v0.7.0
require golang.org/x/text v0.9.0

4
go.sum
View File

@ -1,2 +1,2 @@
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=

View File

@ -6,8 +6,9 @@ import (
"errors"
"golang.org/x/text/encoding/simplifiedchinese"
"golang.org/x/text/transform"
"io/ioutil"
"io"
"net"
"os"
"strings"
"sync"
)
@ -39,7 +40,7 @@ func byte3ToUInt32(data []byte) uint32 {
func gb18030Decode(src []byte) string {
in := bytes.NewReader(src)
out := transform.NewReader(in, simplifiedchinese.GB18030.NewDecoder())
d, _ := ioutil.ReadAll(out)
d, _ := io.ReadAll(out)
return string(d)
}
@ -161,7 +162,7 @@ func LoadData(database []byte) {
// LoadFile 从文件加载IP数据库
func LoadFile(filepath string) (err error) {
data, err = ioutil.ReadFile(filepath)
data, err = os.ReadFile(filepath)
if err != nil {
return
}