Repository: sealdice/sealdice-core (language: go)

Issue:
[Misc] 只保留一个 toml 库
目前在 sealdice-core 中同时使用了 2 个 toml 库：`github.com/pelletier/go-toml/v2` 和 `github.com/BurntSushi/toml`。

应当对比优劣后去掉一个。



Discussion / hints:

Fix patch:
diff --git a/dice/ext_deck.go b/dice/ext_deck.go
index e918eefc..aa5a902a 100644
--- a/dice/ext_deck.go
+++ b/dice/ext_deck.go
@@ -18,9 +18,9 @@ import (
 	"strings"
 	"time"
 
-	"github.com/BurntSushi/toml"
 	"github.com/mitchellh/mapstructure"
 	wr "github.com/mroth/weightedrand"
+	"github.com/pelletier/go-toml/v2"
 	"github.com/sahilm/fuzzy"
 	"github.com/tailscale/hujson"
 	"gopkg.in/yaml.v3"
diff --git a/dice/platform_adapter_walleq_helper.go b/dice/platform_adapter_walleq_helper.go
index c5486dd1..f49d53e7 100644
--- a/dice/platform_adapter_walleq_helper.go
+++ b/dice/platform_adapter_walleq_helper.go
@@ -10,8 +10,8 @@ import (
 	"strings"
 	"time"
 
-	"github.com/BurntSushi/toml"
 	"github.com/google/uuid"
+	"github.com/pelletier/go-toml/v2"
 
 	"sealdice-core/utils/procs"
 )
@@ -296,8 +296,13 @@ func (pa *PlatformAdapterWalleQ) SetQQProtocol(protocol int) bool {
 	log := pa.EndPoint.Session.Parent.Logger
 
 	wd := filepath.Join(pa.Session.Parent.BaseConfig.DataDir, pa.EndPoint.RelWorkDir)
+	wdData, err := os.ReadFile(wd)
+	if err != nil {
+		log.Error("读取 Walle-q 配置文件失败，请检查！")
+		return false
+	}
 	wqc := new(WalleQConfig)
-	_, err := toml.DecodeFile(wd, wqc)
+	err = toml.Unmarshal(wdData, wqc)
 	if err != nil {
 		log.Error("读取 Walle-q 配置文件失败，请检查！")
 		return false
diff --git a/go.mod b/go.mod
index 8a2b3ab1..5fc84b78 100644
--- a/go.mod
+++ b/go.mod
@@ -47,14 +47,12 @@ require (
 )
 
 require (
-	github.com/BurntSushi/toml v1.3.2
 	github.com/Masterminds/semver/v3 v3.2.1
 	github.com/Szzrain/DingTalk-go v0.0.8-alpha
 	github.com/fyrchik/go-shlex v0.0.0-20210215145004-cd7f49bfd959
 	github.com/glebarez/go-sqlite v1.22.0
 	github.com/go-creed/sat v1.0.3
 	github.com/golang-module/carbon v1.7.3
-	github.com/gonutz/w32/v2 v2.11.1
 	github.com/gorilla/websocket v1.5.1
 	github.com/grokify/html-strip-tags-go v0.0.1
 	github.com/jmoiron/sqlx v1.3.5
diff --git a/go.sum b/go.sum
index 6a2b670c..1a42dd3b 100644
--- a/go.sum
+++ b/go.sum
@@ -1,6 +1,5 @@
+github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
-github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8=
-github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
 github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0=
 github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ=
 github.com/RoaringBitmap/roaring v1.2.3 h1:yqreLINqIrX22ErkKI0vY47/ivtJr6n+kMhVOVmhWBY=
@@ -174,8 +173,6 @@ github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg
 github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
 github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
 github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
-github.com/gonutz/w32/v2 v2.11.1 h1:plG738ZY7VIkPGf3adZ6lFeAf2evCKrULKyZT5GrPoc=
-github.com/gonutz/w32/v2 v2.11.1/go.mod h1:MgtHx0AScDVNKyB+kjyPder4xIi3XAcHS6LDDU2DmdE=
 github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
 github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
 github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=


Test patch: