From 77f0930081569a81915788710ca7fa2104f67fbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Wed, 23 Oct 2024 17:27:26 +0800 Subject: [PATCH] fix --- file.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/file.go b/file.go index 580d3e7..4b4f2e8 100644 --- a/file.go +++ b/file.go @@ -121,7 +121,7 @@ func (f *file) ReadTomlContent(filePath string, result any) error { if nil == result { return errors.New("接收读取结果的数据指针为NIL") } - if _, err := toml.DecodeFile("example.toml", result); err != nil { + if _, err := toml.DecodeFile(filePath, result); err != nil { return err } return nil @@ -147,9 +147,7 @@ func (f *file) ReadAnyFileContent(filePath string, receiver any) error { switch fileExt { case consts.FileTypeJson: parseFunc = f.ReadJSONContent - case consts.FileTypeYml: - fallthrough - case consts.FileTypeYaml: + case consts.FileTypeYml, consts.FileTypeYaml: parseFunc = f.ReadYmlContent case consts.FileTypeIni: parseFunc = f.ReadIniContent