update go mod

This commit is contained in:
白茶清欢 2023-08-11 11:28:17 +08:00
parent ba6140d547
commit e6ad534a9a
3 changed files with 9 additions and 4 deletions

View File

@ -9,6 +9,7 @@ package serialize
import ( import (
"errors" "errors"
"git.zhangdeman.cn/zhangdeman/consts"
"io" "io"
"net/http" "net/http"
"os" "os"
@ -141,13 +142,13 @@ func (f *file) ReadAnyFileContent(filePath string, receiver interface{}) error {
fileExt := strings.ToLower(fileInfoArr[len(fileInfoArr)-1]) fileExt := strings.ToLower(fileInfoArr[len(fileInfoArr)-1])
switch fileExt { switch fileExt {
case "json": case consts.FileTypeJson:
parseFunc = f.ReadJSONContent parseFunc = f.ReadJSONContent
case "yml": case consts.FileTypeYml:
fallthrough fallthrough
case "yaml": case consts.FileTypeYaml:
parseFunc = f.ReadYmlContent parseFunc = f.ReadYmlContent
case "ini": case consts.FileTypeIni:
parseFunc = f.ReadIniContent parseFunc = f.ReadIniContent
default: default:
return errors.New(fileExt + " 暂不支持当前格式的文件解析") return errors.New(fileExt + " 暂不支持当前格式的文件解析")

2
go.mod
View File

@ -8,3 +8,5 @@ require (
github.com/go-ini/ini v1.67.0 github.com/go-ini/ini v1.67.0
gopkg.in/yaml.v3 v3.0.1 gopkg.in/yaml.v3 v3.0.1
) )
require git.zhangdeman.cn/zhangdeman/consts v0.0.0-20230811030300-6f850372c88c // indirect

2
go.sum
View File

@ -1,3 +1,5 @@
git.zhangdeman.cn/zhangdeman/consts v0.0.0-20230811030300-6f850372c88c h1:Dan3iSVU6XTKt8r3/qixfPHPpfLZjkYlPmaJios7wtE=
git.zhangdeman.cn/zhangdeman/consts v0.0.0-20230811030300-6f850372c88c/go.mod h1:IXXaZkb7vGzGnGM5RRWrASAuwrVSNxuoe0DmeXx5g6k=
git.zhangdeman.cn/zhangdeman/util v0.0.0-20230810093304-ccb4045065c4 h1:MgZ2f1BkUtfP8D6uDX9S8o+V4wYUw76HlAw3xCH9epA= git.zhangdeman.cn/zhangdeman/util v0.0.0-20230810093304-ccb4045065c4 h1:MgZ2f1BkUtfP8D6uDX9S8o+V4wYUw76HlAw3xCH9epA=
git.zhangdeman.cn/zhangdeman/util v0.0.0-20230810093304-ccb4045065c4/go.mod h1:tPl6isAsRQLZrX8G3/8fCdhN4OcZypdmdHR/PDkd2PY= git.zhangdeman.cn/zhangdeman/util v0.0.0-20230810093304-ccb4045065c4/go.mod h1:tPl6isAsRQLZrX8G3/8fCdhN4OcZypdmdHR/PDkd2PY=
github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8= github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8=