Goutil 版本更新日志
gookit/goutil
Go 常用功能的扩展工具库。包含:数字,字符串,slice/数组,Map,结构体,反射,文本,文件,错误,时间日期,测试,CLI,命令运行,系统信息,格式化,常用信息获取等等。
信息
功能特点
基础工具包
arrutil
array/slice 相关操作的函数工具包 如:类型转换,元素检查等等cliutil
CLI 的一些工具函数包. eg: read input, exec commandcliutil/cmdline
提供 cmdline 解析,args 构建到 cmdline
envutil
ENV 信息获取判断工具包. eg: get one, get info, parse varfmtutil
格式化数据工具函数 eg:数据sizefsutil
文件系统操作相关的工具函数包. eg: file and dir check, operategoinfo
提供一些与Go info, runtime 相关的工具函数。jsonutil
一些用于快速读取、写入、编码、解码 JSON 数据的实用函数。maputil
map 相关操作的函数工具包. eg: convert, sub-value get, simple mergemathutil
int/number 相关操作的函数工具包. eg: convert, math calc, randomnetutil
Network util functions. eg: Ip, IpV4, IpV6, Mac, Port, Hostname, etc.reflects
提供一些扩展性的反射使用工具函数.structs
为 struct 提供一些扩展 util 函数。 eg: tag parse, struct datastrutil
string 相关操作的函数工具包. eg: bytes, check, convert, encode, format and moresysutil
system 相关操作的函数工具包. eg: sysenv, exec, user, process
扩展工具包
cflag
: 包装和扩展 goflag.FlagSet
以方便快速的构建简单的命令行应用程序dump
GO变量打印工具,打印 slice, map 会自动换行显示每个元素,同时会显示打印调用位置encodes
: Provide some encoding/decoding, hash, crypto util functions. eg: base64, hex, etc.errorx
为 go 提供增强的错误实现,允许带有堆栈跟踪信息和包装另一个错误。fsutil/finder
提供简单方便的file/dir查找功能,支持过滤、排除、匹配、忽略等。- netutil 子包:
netutil/httpreq
包装 http.Client 实现的更加易于使用的HTTP客户端, 和一些 http 工具函数
- strutil 子包:
strutil/textscan
实现了一个快速扫描和分析文本内容的解析器. 可用于解析 INI, Properties 等格式内容strutil/textutil
提供一些常用的扩展文本处理功能函数。
syncs
提供一些同步、协程、信号相关的工具函数.- sysutil 子包:
sysutil/clipboard
提供简单的剪贴板读写操作工具库sysutil/cmdr
提供快速构建和运行一个cmd,批量运行多个cmd任务sysutil/process
提供一些进程操作相关的实用功能。
testutil
test help 相关操作的函数工具包. eg: http test, mock ENV valuetestutil/assert
用于帮助测试的断言函数工具包,方便编写单元测试。testutil/fakeobj
提供一些接口的假的实现,用于模拟测试. 例如fs.File, fs.FileInfo, fs.DirEntry
等等.
timex
提供增强的 time.Time 实现。添加更多常用的功能方法- 提供类似
Y-m-d H:i:s
的日期时间格式解析处理 - 常用时间方法。例如:
DayStart(), DayAfter(), DayAgo(), DateFormat()
等等
- 提供类似
版本更新记录
- 2024.01.24 发布 v0.6.15 更新说明
- 2023.10.16 发布 v0.6.14 更新说明
- 2023.07.25 发布 v0.6.12 更新说明
v0.6.8 更新日志
Fixed
- ✅ fix: fix go import error and re-generate docs https://github.com/gookit/goutil/commit/049780ec02a6ef301b0d729378a3d99d31772d93
Feature
- ✨ feat(str): add new util func PathMatch, MatchNodePath for match string path https://github.com/gookit/goutil/commit/53f77697e2ecd0678484306716f031901877a442
- ✨ feat(stdio): add new util func for quick output to stdout https://github.com/gookit/goutil/commit/4120075ba4cde049a30eaf9abfb6828c5cac689d
- ✨ feat(fs): add new util func ResolvePath() and update IsAbsPath() logic https://github.com/gookit/goutil/commit/7797e83182bec003cf3465eee304fe9d0924beaa
- ✨ feat(fs): add new util func ToAbsPath() for convert path https://github.com/gookit/goutil/commit/247c554c223e3fb9160e442eb10de3d86d022f67
- ✨ feat(fs): add new util func SearchNameUp() for search file or dir path https://github.com/gookit/goutil/commit/d6255eefa015347b4385a65a633196f456c129c0
- ✨ feat(net/ctype): add new util func for check content-type https://github.com/gookit/goutil/commit/a995df0a282963099b956dba311f509c8fc57374
- ✨ feat(str/text): replacer support parse env variable https://github.com/gookit/goutil/commit/411ef1fd561549a01f5b4dac274d77d51f5c4688
- ✨ feat(str/text): replacer support disable flatten vars map https://github.com/gookit/goutil/commit/f4abba10bad6dd1c680e1e1397124d2015a8461c
- ✨ feat(fsutil): add more filter for quick use the FindInDir() https://github.com/gookit/goutil/commit/78243ff9da8e611865b5126810777960b15915d2
- ✨ feat(math): add new util Min, SwapMin func and add more tests https://github.com/gookit/goutil/commit/19ba2eb794ed4a8817089cb3ba9168b77e7602a2
- ✨ feat(str/text): VarReplacer support NotFound handler and default value https://github.com/gookit/goutil/commit/767039300526430da68f49f12efbeffac5f4ae99
- ✨ feat(net/hreq): add more util func and simple basic-auth build https://github.com/gookit/goutil/commit/ea450e971c256eb49e44f522c58cbda1eb335010
- ✨ feat(map): add new util func EachAnyMap, ToAnyMap https://github.com/gookit/goutil/commit/247e7518413cdaeb6f2d31c6d06c42f0315c1465
- ✨ feat(net/httpreq): add new option for send request, and add some new util func https://github.com/gookit/goutil/commit/721b54a83f827fd7c3a25685bcd48263d83d0056
- ✨ feat(json,reflect): reflect add new util func for handle map data https://github.com/gookit/goutil/commit/9e8a6609fdffa82e4a58137d6ef69e9c5468ccec
- ✨ feat(fs): add new util func PathMatch for match path https://github.com/gookit/goutil/commit/86abf8efb1fbf3373c27633d303b829d13cfbc50
Update
- 👔 up(fmt,math): move commonly util func to pkg basefn https://github.com/gookit/goutil/commit/52217819e1d2f6c8340809d619764dc95816bc72
- 👔 up(sys): rename a internal func and update some call name https://github.com/gookit/goutil/commit/17aeb31f248057740bcf0822a327137f2818eeb5
- 👔 up(net/httpreq): update some client method logic https://github.com/gookit/goutil/commit/9454259991af6a3e135b483d6e2ed5c6d613cf59
- 👔 up(arr,byte): update some tests and add byteutil add new func https://github.com/gookit/goutil/commit/a31b4d621d8f14702be8d95051fbb310ed8ee8ca
- 👔 up(cflag): update some method logic and add more tests https://github.com/gookit/goutil/commit/62df9a82bfacc1bb4bb4e559ae825a6beb721513
- 👔 up(maputil): update some method logic and add more method for Map https://github.com/gookit/goutil/commit/e7c80d4cb88ad064c7d58fc6173b827803bf1323
- 👔 up(test,doc): update some tests and re-generate docs https://github.com/gookit/goutil/commit/c72adcb7e023c6f7109d5a0586856e5054f216c9
- 👔 up(fs): add new fs util JoinSubPaths for join paths https://github.com/gookit/goutil/commit/a56a93e19e32344faad48741e5af8d8d400080f0
- 👔 up(arr,cflag): optimize some util and methods logic https://github.com/gookit/goutil/commit/303b69926a8d983d9c36d1709f02deab24f33544
- 👔 up(fs): update the Realpath logic, will always return abs path https://github.com/gookit/goutil/commit/59575e67dd4927c403e6283981d250edcd3925b7
- 👔 up(text,struct): update some util method, fix text replace error https://github.com/gookit/goutil/commit/a3f173c53c6cacf562b77b416a95407f1f7828b1
- 👔 up(all): update some util func, add some new util func https://github.com/gookit/goutil/commit/1784bb5c9f5457b2177a9ca8239534c0b17d21a1
- 👔 up(str/text): add new option can keep missing vars https://github.com/gookit/goutil/commit/346870e22f1c054c34c833794c41e9fd590d3d7d
- ✨ up(net,sys): update some sys and net util func logic https://github.com/gookit/goutil/commit/fad9894b7ecd87d06f81b33a2d07a9d80097ca05
Other
- build(deps): bump morphy2k/revive-action from 2.4.1 to 2.5.0 (#88) https://github.com/gookit/goutil/commit/9c81ef396e3789b2b8279d25f51b1622a4c3cbc8
- build(deps): bump morphy2k/revive-action from 2.5.0 to 2.5.1 (#89) https://github.com/gookit/goutil/commit/a1885579441754dbf27f10dd4c4149bc5f32eb39
- ✅ chore(tests): fix some tests error on windows https://github.com/gookit/goutil/commit/78ded5752679e5ccfa7e200a081578e896adc505
- sysutil: non-Linux OS support (#90) https://github.com/gookit/goutil/commit/78df8c84c4c61c8e6f1a98391c360703dd483e54
- build(deps): bump github.com/gookit/color from 1.5.2 to 1.5.3 (#91) https://github.com/gookit/goutil/commit/bc33394ac4118011d404e24c1e657f0d8095494a
v0.6.6 更新日志
Feature
- ✨ feat(cflag): add new extra flag value IntsString https://github.com/gookit/goutil/commit/cdec762f9013455212eb4d192ba959bcef192b56
- ✨ feat(env,sys): add new sys env get and build func EnvironWith https://github.com/gookit/goutil/commit/88c83fe795fcfc117bdc72aa5c00e92d900661c5
- ✨ feat(str/textutil): text.VarReplacer support string-map as replace context https://github.com/gookit/goutil/commit/9374e1987c63e16ea1247bc75e517c5fc9a168c5
- ✨ feat(sys/clip): update and enhance clipboard operate logic https://github.com/gookit/goutil/commit/fc98d06b2ebae1a992ffef5a6c334f06ebf8b975
- ✨ feat(cmdr): support set workdir and env-map on run command https://github.com/gookit/goutil/commit/7460c0f0d3ff7673ee7988424396fe826d02d228
- ✨ feat(fs): update and add some fs util func https://github.com/gookit/goutil/commit/ededf5b456b9e14e4c8be815008753f124d8680b
- ✨ feat(base): add new pkg basefn for provide some base func https://github.com/gookit/goutil/commit/4cd72425fb8f2ec82bfd3bbfe6046cdd6501c3d1
Update
- 👔 up(map): update and enhance some util func logic https://github.com/gookit/goutil/commit/69dbc9a531d1827ea577a110cb525b09520c4a87
- 👔 up(cli): update the cli line builder logic https://github.com/gookit/goutil/commit/5036234d68d33f7422d80b329104b7c24d54bb35
- ✨ up(math): add new util func SafeInt64 https://github.com/gookit/goutil/commit/39019ad9f5e6c36f25e995b41eb6e47ca0c01cb3
- ✨ up(stdio): add new func WriteString, WriteBytes for write to stdout https://github.com/gookit/goutil/commit/b40b23794027fcd1446adbd9f64b57426707724c
- 👔 up(str/text): update the replacement format parse logic, allow one left char https://github.com/gookit/goutil/commit/ccf24309f3b708815d0cd3ba078b2e0ae655f920
- 👔 up(cli/cmdline): use strings.Builder refactor the cmdline.Builder logic https://github.com/gookit/goutil/commit/7060159167e0267a0c181993c6fdae97ca4fdb93
- 👔 up(cli/cmdline): refactor the cmdline.LineParser logic and add more tests https://github.com/gookit/goutil/commit/77bac4b7f12db3edaa9a43a01a21a71d18872217
- 👔 up(sys/clip): add new util func clipboard.Std() https://github.com/gookit/goutil/commit/9f81953ab2960d7a9b6b501c5fc8147c78a5ec47
- 👔 up(str,byte): update some util func and add more tests https://github.com/gookit/goutil/commit/531fa6b412b5b264c559e5009b5371d38560b915
- 👔 up(stdio,assert): add more util func and add more tests https://github.com/gookit/goutil/commit/000ca9064266197bd0626b6d60464113ca407f49
Other
- build(deps): bump golang.org/x/term from 0.5.0 to 0.6.0 (#86) https://github.com/gookit/goutil/commit/b2962fb70a923921432de2ce90d7a80f8d34fee4
- build(deps): bump golang.org/x/text from 0.7.0 to 0.8.0 (#85) https://github.com/gookit/goutil/commit/57a853d2f92e367b2efa629adce069d20d35e680
- 📝 chore: add more tests and update readme docs https://github.com/gookit/goutil/commit/3c23237083265a86202de5429bd7b68d4920a3f2
v0.6.6 更新日志
Fixed
- 💚 fix: fix unit test error https://github.com/gookit/goutil/commit/ba0c414e7fda69b1c38f86c83f78dfc53cc08b90
- 🐛 fix(fs): fix test error on Windows https://github.com/gookit/goutil/commit/f290bee792acee966769c21ea8d4e96f5738034d
- 🐛 fix(sys): fix test error on Windows https://github.com/gookit/goutil/commit/8dab697bb4c39a851dd7b8a7bfb6f1d3066cfcae
Feature
- ✨ feat(cflag): new add cflag.KVString flag value https://github.com/gookit/goutil/commit/8fe06c4ebb3fbf66a40a8fa89bd4b74167c14a75
- ✨ feat(str): add new util func SplitKV() and ContainsByte() https://github.com/gookit/goutil/commit/d593952b9fdb7ea557c4510d4fac39bd54cb19e9
Update
- 👔 up(sys): update the os check and open URL logic https://github.com/gookit/goutil/commit/e500a04f5a7a576b2d94f0ec46a14f6c282d83dd
- 👔 up(sys): update and add some cmdr build methods https://github.com/gookit/goutil/commit/0cd4fda7a9f9444597fae42378813cbce171f013
- 👔 up(fs): update some fs info util functions https://github.com/gookit/goutil/commit/2052663d151d43506675ea884fc2ede9cd941e3e
- ✨ up(map): add new util func SimpleMerge() and Data.Load() https://github.com/gookit/goutil/commit/87534df20c5768fe9626034454c15b04fb09bc9e
- 👔 up(doc): update the README docs, cmdr add method AddCmdline() https://github.com/gookit/goutil/commit/2f3c2d7864c051f6a472a0425cf6845ccd7d839a
- 👔 up(cflag,doc): update readme docs, add more tests for cflag https://github.com/gookit/goutil/commit/c9dcde97abdc14b71d75c6f886ba70b1dcb194f9
Other
- ⬆️ dep: update some deps to the latest version https://github.com/gookit/goutil/commit/028ef72793c3c388bf3470c0fb7faa69ea37441a
- 🎨 chore(all): fix and update some code style check error https://github.com/gookit/goutil/commit/f9983573f7ebe84250dab880e570f7e755753d5e
v0.6.5 更新日志
Feature
- ✨ feat(cli,cflag): add add new flag var ConfString https://github.com/gookit/goutil/commit/40a14e0db0c6acf3c8b3d2a7bcf5ee2e948fa976
- ✨ feat(textutil): add func ParseInlineINI quick parse inline INI config https://github.com/gookit/goutil/commit/9cd6487d7c05abbcecd51d81ec9af974b8655f0f
- ✨ feat(str): add QuickMatch and GlobMatch for match string https://github.com/gookit/goutil/commit/8d5e4f4a72c6e30df83db5e4c68a30e374e4093f
- ✨ feat(str): add struct Builder for safe build string https://github.com/gookit/goutil/commit/b34245efa74a11e639eafb0749b2d888ae3af9c4
- ✨ feat(err,byte,go): add some new util functions https://github.com/gookit/goutil/commit/3d304b0a87320a509315ee72a277224c99712060
- ✨ feat(arr,map): add new util func CombineToSMap https://github.com/gookit/goutil/commit/3699a1acfdfb0ea969d6b434353cd0443a6c38c8
- ✨ feat(cflag,struct): add new util func IsGoodName, ParseTagValueQuick https://github.com/gookit/goutil/commit/40ccfb8f646f062aec0b5694074c01388f2c14c0
Update
- ♻️ up(errorx): add errorx/panics from testutil/panics https://github.com/gookit/goutil/commit/06b949dce2582696bfb843434cfcd1c15a60fd59
- 👔 up(arr,sys): add alias method for exist util func https://github.com/gookit/goutil/commit/dcc5261ebbcff69d94e7d0979ad3a1d393464b9f
- 📝 up(doc): update and re-gen the readme docs https://github.com/gookit/goutil/commit/e6498a3302d3243f7f88367dc59e4541246cb154
v0.6.4 更新日志
Released at 2023.02.11
- 🐛 fix(dump): makeslice: cap out of range. fix: #76 4ba9b10
v0.6.3 更新日志
Released at 2023.02.11
Update
- ✨ up(env,sys): 新增 GetMulti, SetEnvMap, UnsetEnvs 等函数 9eaddb5
- 👔 up(str): 调整 SplitInlineComment() 处理逻辑 31445cd
- 👔 up(sys): 调整 SearchPath() 逻辑, 支持限制返回结果数 67cbae1
- ✅ up(sys,env,map): add more tests case for util func 392536c
- 👔 up(fs,sys): update some fs and sys util func run logic 7727628
- 👔 up(struct): update some structs comments and update readme f461852
- 👔 up(str): update some string util comments and func 796d1fe
Other
- build(deps): bump golang.org/x/text from 0.6.0 to 0.7.0 1e3ea77
v0.6.2 更新日志
Released at 2023.02.02
Feature
- 👔 feat: str - 新增检查方法 ContainsOne, ContainsAll, HasEmpty, IsAllEmpty 等 0e4792a
- 👔 feat: str/textutil - 支持快速替换给定文本的变量 ecc23cb
- 👔 feat: sys,proc - 添加和更新一些实用函数 aa78114
- ✨ feat: fs - 添加一些实用函数 NewIOReader,TextScanner,LineScanner,ReadFile,ReadString 等 3352512
- ✨ feat: map, struct - 新增实用函数 structs.ToString(), maputil.Data.Uint() 90af09e
- ✨ feat: stdio - 新增实用函数 NewIOReader, NewScanner ea243d6
- ✨ feat: arr - 新增检查函数 NotIn, In, ContainsAll/IsParent 2a18ca2
- ✨ feat: textutil - 新增函数 IsMatchAll() 快速检查文本是否有关键字 d0dade8
- ✨ feat: math - 新增泛型函数 Max, SwapMax 比较和交换值 176923b
- feat: error, test - 新增工具函数 快速断言并返回错误或直接panic 7188216
- ✨ feat: fs - 新增函数 MkDirs, MkSubDirs 批量创建目录或子目录 c4447cb
- ✨ feat: env,sys - 新增函数 EnvPaths, SearchEnvKeys, SearchEnv 快速获取和搜索环境变量 b3d7669
- ✨ feat: str - 新增函数 IEqual, IContains 忽略大小写检查字符串 746eb35
- ✨ feat: goutil - 新增函数 CallOn, CallOrElse, OrError, OrValue, OrReturn 基于条件运行或返回值 97a2863
- ✨ feat: arr - 新增函数 StringsAsInts, StringsTryInts, ConvType 等快速转换slice类型 75d8d89
- ✨ feat: reflects - 新增函数 ConvSlice 通过反射方式转换 slice 类型 f87fc86
- ✨ feat: structs - 初始化结构体 InitDefaults() 新增支持 slice 类型字段 948fa70
- ✨ feat: byte - 新增函数 StrOrErr(), SafeString() 检查并在无错误时转为string 767ed80
- ✨ feat: cmdr - cmdr.Cmd 新增方法 ToOSStdoutStderr, ToOSStdout 快速设置命令输出到 OS stdout, stderr 6aaea78
Update
- 👔 up: str, math - 新增一些 OrElse() 等快速检测同时获取值的函数 cb21fbc
- 👔 up: str - update some util func and add more tests a3e07f4
- 👔 up: str,math - update some util func eaf0990
- 👔 up: str,byte - add and update some util func cf5d34e
- 👔 up: byte,cflag - update and add some new tests 6e47f69
- 👔 up(env, str): 调整 ENV 变量解析逻辑 和新增 strutil.Valid() 5193849
- 👔 up(str): update some str value get func 676fe4e
Fixed
- 🐛 fix(env, str): fix the envutil test error and update some str util 2e7aa63
- 🐛 fix: textscan - fix multi inline comments parse error bf68c94
Other
- build(deps): bump golang.org/x/text from 0.5.0 to 0.6.0 79d7781
- doc: re-generate the README docs 42e3084
- doc: update the doc parse logic, support generic types 030676d
- doc: generate and update README docs f342e92
v0.6.1 更新日志
发布于 2022.12.12
新特性
- ✨ feat: 添加新的子包 byteutil 提供一些字节相关的工具方法 https://github.com/gookit/goutil/commit/e5a08d4ea5eea1c7571f3b11cde3d59f8b89e473
- ✨ feat: 添加新的子包 strutil/secutil 提供 aes cbc 加密功能 https://github.com/gookit/goutil/commit/e121b7c1232b2ec0fb2822242602e6828cb6923b
- ✨ feat(dump): dump 支持 []byte 作为字符串打印和新增更多新选项 https://github.com/gookit/goutil/commit/025464a32940e585c83b76413dc5f18fd4459197
- ✨ feat(structs): 添加新的工具方法用于检查结构字段是否可导出 https://github.com/gookit/goutil/commit/179afea5759f5bc5f3373a1b9238abf4a8257274
- ✨ feat(dump): 支持通过选项 SkipNilField 在 dump 时跳过 nil 字段 https://github.com/gookit/goutil/commit/a55c5ca4939845f91a72d2c3c49dcf16e9343127
- 添加 SubstrCount 和测试用例。 https://github.com/gookit/goutil/commit/1bff3b30b0619650a07512f5eb67b2da1981c0b8
更新调整
- 向上:str,数学 - 更新一些 int64 到字符串转换 https://github.com/gookit/goutil/commit/449331c8d2e54db9b963fb794d7bdce19511dcf7
- 👔 up: str - 更新字节工具方法并添加新的哈希工具方法 https://github.com/gookit/goutil/commit/8eef351026d5654e6475b9a44bd9f6fd3525c753
- 🔥 up: 删除不推荐使用的包 common https://github.com/gookit/goutil/commit/17c48953a865f1d4af203d6db47410d69db58c7d
其他
- 构建(deps):将 golang.org/x/text 从 0.4.0 提升到 0.5.0 https://github.com/gookit/goutil/commit/5297b13dd32936b2d3c3bfc051e817ca6999ee9d
- doc:更新一些说明文件并重新生成README文件 https://github.com/gookit/goutil/commit/c3f5086cbae508d94bd20b0c19a4253aabd15821
- 💡 chore: 添加包注释或导出的 var 注释 https://github.com/gookit/goutil/commit/6ace647b01b923f158a5bb1b8af0e8573eb347d9
- 💡 chore: 添加导出的 var 注释,修复一些名称样式 https://github.com/gookit/goutil/commit/ea10bc76842b7c3d82af39c155a59c5d9eeebe99
- 💡 chore: 为导出的变量、方法添加注释。 https://github.com/gookit/goutil/commit/bc0a0b8322a198f4532a02bddfb804e8b25761b6