From 01491ac5e0db07ae946147c23c0f0b5a671a8023 Mon Sep 17 00:00:00 2001 From: xiaoqidun Date: Fri, 7 Apr 2023 15:32:15 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=8D=87=E7=BA=A7=E4=BE=9D=E8=B5=96):=20?= =?UTF-8?q?=E5=8D=87=E7=BA=A7=E4=BE=9D=E8=B5=96=E5=B9=B6=E5=8E=BB=E6=8E=89?= =?UTF-8?q?=E5=BA=9F=E5=BC=83=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 2 +- go.sum | 4 ++-- qqwry.go | 7 ++++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 0523df7..1705cf1 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 44d8b0d..20cf523 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/qqwry.go b/qqwry.go index 567cddd..aaef853 100644 --- a/qqwry.go +++ b/qqwry.go @@ -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 }