gookit/goutil An extended library of Go's common functionality. Contains: number, string, slice/array, Map, struct, reflection, text, file, error, time and date, test, CLI, command run, system information, formatting, common information acquisition, etc. Github: https://github.com/gookit/goutil Full changelog v0.6.9...v0.6.10 ✨ feat: testutil - adds a new child package fakeobj to create fake objects for testing ✨ feat: testutil - adds a new function NewEchoServer() to start the echo server ✨ feat: byteutil - Buffer adds more useful methods for ease of use ✨ feat: dump - Special handling of custom int, uint type values, will print instructions in String format ✨ feat: fsutil - adds a new function to Glob() quickly list matching files ♻️ feat: httpreq - Refactoring the built-in HTTP client httpreq logic 👔 up: structs - Update and support InitDefaults() for struct slice fields that are not null 👔 up: maputil - SimpleMerge() Supports deep merging of map[string]any data ✅ test: Update some documentation and fix some unit tests ⬆️ dep: Update golang.org/x depends on the latest version dump - special handles custom int, uint type values, and will print instructions in String format Support for initializing the use of environment variables Support initializing slice fields and nesting structs ** Initialization result:** Use testutil.NewEchoServer() to quickly create an HTTP echo server. Convenient for testing HTTP requests, responses, etc. Usage examples: Full changelog v0.6.8...v0.6.9 strutil - Added ToByteSize(),SafeByteSize() for converting size string (eg: 5MB) to byte size strutil has added ParseSizeRange() to facilitate and quickly parse string size range expressions eg: 200kb~50mb strutil - Added new utility functions: DatetimeNo(), RandWithTpl(), SimpleMatch() byteutil - Add new utility functions: Random(), AppendAny() fsutil - Add new utility functions: ReadOrErr(), ReadStringOrErr() cliutil - Add new utility functions: Confirm(), ReadAsBool() errorx - Add new utility functions Err(), Errf() for easy creation of error structs - InitDefaults() enhanced to support nested structure pointer initialization structs - SetValues() enhanced to support setting and processing structure pointer values structs - Add ToSMap(), TryToSMap(), TryToSMap() to convert structure to string map testutil/assert new assertion methods NotContainsKey(), NotContainsKeys() Reflects new utility methods UnexportedValue(), SetUnexportedValue() maputil new tool functions HasOneKey(), CombineToMap(), TryAnyMap() Added utility functions AnyToSlice(), CombineToMap() in arrutil jsonutil has added tool methods IsJSON(), IsJSONFast() to check whether it is JSON ♻️ fsutil/finder file and directory search reconstruction, enhanced functions, more convenient to use timex new utility functions NowAddSec(), IsDuration(), InRange() timex ToDuration() enhanced, support unit d, w and long unit hour, min, sec mathutil new tool methods InRange(), OutRange(), InUintRange() fsutil new tool method RemoveSub() to quickly delete subdirectories and files maputil GetByPath() is enhanced to support matching paths similar to top.*.field to get values strutil optimization ToByteSize() and GlobMatch() logic struts - InitDefaults() supports initializing non-zero ptr substructure fields 💥 struts - InitDefaults() To initialize a substructure, the field must be marked with default:"" 📝 doc: README documentation updated, some subpackages added README ✅ test: Added and fixed some unit tests ⬆️ dep: update golang.org/x dependencies to latest version fsutil/finder Provides a simple and fast way to find matching files and directories. Built-in support Name, extension, suffix, prefix, glob, path, etc. include or exclude Support matching file size, modification time (ModTime) and other extended matching methods It is easy to parse the string size range to byte size. Examples of supported expression formats: timex.ParseRange() It is easy to quickly parse the relative time size range or keyword into time.Time Examples of supported expression formats: For more instructions, see Unit tests for README and related methods Github: https://github.com/gookit/goutil