git clone https://git.r00t2.io/r00t2/go_goutils.git
+cd go_goutils
+.githooks/pre-commit/01-docgen
+net
+net
netCidrMasknetExtractAddrnetExtractHostnetExtractIpnetnetExtractPortnetIfacesnetIp4MasknetJoinHostPortnetParseIPnetCidrMasknetExtractAddrnetExtractHostnetExtractIpnetnetExtractPortnetIfacesnetIp4MasknetJoinHostPortnetParseIPnet/netip
+net/netip
go4.org/netipx
+go4.org/netipx
netipxAddrIpNetnetipxCmpPfxnetipxFromStdAddrnetipxFromIpnetipxFromIpNetnetipxParseRangenetipxPfxAddrnetipxPfxIpNetnetipxPfxLastnetipxPfxRangenetipxRangenetipxAddrIpNetnetipxCmpPfxnetipxFromStdAddrnetipxFromIpnetipxFromIpNetnetipxParseRangenetipxPfxAddrnetipxPfxIpNetnetipxPfxLastnetipxPfxRangenetipxRangenetx
+
osFQDNosGroupByIdosGroupByNameosHostosHostnameosIdStateosUserosUserByIdosUserByNameosFQDNosGroupByIdosGroupByNameosHostosHostnameosIdStateosUserosUserByIdosUserByNamepsHostBootpsHostIdpsHostInfopsHostKernArchpsHostKernVerpsHostPlatInfopsHostPlatUptimepsHostUserspsHostPlatVirtpsHostBootpsHostIdpsHostInfopsHostKernArchpsHostKernVerpsHostPlatInfopsHostPlatUptimepsHostUserspsHostPlatVirtpsNetConnspsNetConnsMaxpsNetConnsPidpsNetConnsPidMaxpsNetCTStatspsNetCTStatListpsNetFilterCntspsNetIoCntspsNetIoCntsFilepsNetIfacespsNetPidspsNetProtoCntpsNetRevpsNetConnspsNetConnsMaxpsNetConnsPidpsNetConnsPidMaxpsNetCTStatspsNetCTStatListpsNetFilterCntspsNetIoCntspsNetIoCntsFilepsNetIfacespsNetPidspsNetProtoCntpsNetRevtmDatetmFloatMicrotmFloatMillitmFloatNanotmFloattmFmttmNowtmParseDur8ntmParseMonthtmParseMonthInttmParseMonthStrtmParseTimetmDatetmFloatMicrotmFloatMillitmFloatNanotmFloattmFmttmNowtmParseDur8ntmParseMonthtmParseMonthInttmParseMonthStrtmParseTimeIf you are reading this README on the Go Module Directory documentation (https://pkg.go.dev/r00t2.io/goutils/tplx/sprigx) -or the directory landing page (https://git.r00t2.io/r00t2/go_goutils/src/branch/master/tplx/sprigx), it may not render correctly.
+or the directory landing page (https://git.r00t2.io/r00t2/go_goutils/src/branch/master/tplx/sprigx), it may not render correctly. +Anchor-links (links within this document to other sections of this document) will likely also not work.Be sure to view it at properly via the AsciiDoc rendering -or by downloading and viewing the HTML version and/or PDF version.
+Be sure to view it at properly via the in-repo AsciiDoc rendering +or by downloading and viewing the HTML version in a browser locally +and/or rendering a PDF version.
This documentation is written in AsciiDoc (with AsciiDoctor extensions).
+To re-render all docs (including PDF):
+git clone https://git.r00t2.io/r00t2/go_goutils.git
+cd go_goutils
+.githooks/pre-commit/01-docgen
+HTML output is re-rendered and included in git on each commit automatically (via github:gabyx/Githooks)
+but can be re-rendered on-demand locally via:
git clone https://git.r00t2.io/r00t2/go_goutils.git
+cd go_goutils
+export orig_dir="$(pwd)"
+cd tplx/sprigx
+asciidoctor -a ROOTDIR="${orig_dir}/" -o README.html README.adoc
+This documentation can be rendered to PDF via asciidoctor-pdf.
+It is not included in git automatically because binary files that change on each commit is not a good idea for git,
+especially for a repo that gets cloned as part of a library inclusion in a module/package dependency system (like gomod).
To render as PDF:
+git clone https://git.r00t2.io/r00t2/go_goutils.git
+cd go_goutils
+export orig_dir="$(pwd)"
+cd tplx/sprigx
+asciidoctor-pdf -a ROOTDIR="${orig_dir}/" -o README.pdf README.adoc
+The same way you would sprig!
They can even be combined/used together.
+They can even be combined/used together,
For example, if both sprig and sprigx provide a function foo:
this will use foo from sprigx
foo from sprigxwhereas this will use foo from sprig
foo from sprigThis would override a function foo and foo2 in sprigx from foo and foo2 from sprig, but leave all other sprig functions untouched.
These are generally intended to be used outside the template in the actual Go code.
CombinedFuncMapCombinedFuncMapCombinedHtmlFuncMapCombinedHtmlFuncMapCombinedTxtFuncMapCombinedTxtFuncMapFuncMapFuncMapHtmlFuncMapHtmlFuncMapNopNopTxtFuncMapTxtFuncMapExpect this list to grow over time, and potentially more frequently than the sprigx functions.
you can easily determine whether a function can return an error or not by simply referring to the Function Signature.
dumpdumpmetaIsNilmetaIsNilThese template functions use capabilities from:
The function prefix is used to indicate which module/package a function is added from.
netnetThese template functions contain capabilities from net.
netCidrMasknetCidrMasknetExtractAddrnetExtractAddrnetExtractHostnetExtractHostnetExtractIpnetnetExtractIpnetnetExtractPortnetExtractPortnetIfacesnetIfacesnetIp4MasknetIp4MasknetJoinHostPortnetJoinHostPortnetParseIPnetParseIPnet/netipnet/netipThese template functions contain capabilities from net/netip.
netipAddrPortnetipAddrPortnetipParseAddrnetipParseAddrnetipParseAddrPortnetipParseAddrPortnetipParsePrefixnetipParsePrefixnetipPrefixnetipPrefixgo4.org/netipxgo4.org/netipxThese template functions contain capabilities from go4.org/netipx.
netipxAddrIpNetnetipxAddrIpNetnetipxCmpPfxnetipxCmpPfxnetipxFromStdAddrnetipxFromStdAddrnetipxFromIpnetipxFromIpnetipxFromIpNetnetipxFromIpNetnetipxParseRangenetipxParseRangenetipxPfxAddrnetipxPfxAddrnetipxPfxIpNetnetipxPfxIpNetnetipxPfxLastnetipxPfxLastnetipxPfxRangenetipxPfxRangenetipxRangenetipxRangenetxThese template functions contain capabilities from r00t2.io/goutils/netx.
netxAddrRfcfunc netxAddrRfc(addr netip.Addr) (rfcStr string)
+netxAddrRfc directly calls r00t2.io/goutils/netx.AddrRfc.
netxCidr4IpMaskfunc netxCidr4IpMask(cidr uint8) (ipMask net.IPMask, err error)
+netxCidr4IpMask directly calls r00t2.io/goutils/netx.Cidr4ToIPMask.
netxCidr4Maskfunc netxCidr4Mask(cidr uint8) (mask uint32, err error)
+netxCidr4IpMask directly calls r00t2.io/goutils/netx.Cidr4ToMask.
netxCidr4Strfunc netxCidr4Str(cidr uint8) (maskStr string, err error)
+netxCidr4Str directly calls r00t2.io/goutils/netx.Cidr4ToStr.
netxFamilyVerfunc netxFamilyVer(family uint16) (ipVer int)
+netxFamilyVer directly calls r00t2.io/goutils/netx.FamilyToVer.
netxGetAddrFamfunc netxGetAddrFam(addr netip.Addr) (family uint16)
+netxGetAddrFam directly calls r00t2.io/goutils/netx.GetAddrFamily.
netxGetIpFamfunc netxGetIpFam(ip net.IP) (family uint16)
+netxGetIpFam directly calls r00t2.io/goutils/netx.GetIpFamily.
netxIpRfcfunc netxIpRfc(ip net.IP) (rfcStr string)
+netxIpRfc directly calls r00t2.io/goutils/netx.IpRfc.
netxIpRfcStrfunc netxIpRfcStr(s string) (rfcStr string)
+netxIpRfcStr directly calls r00t2.io/goutils/netx.IpRfcStr.
netxIpStripRfcfunc netxIpStripRfc(s string) (stripStr string)
+netxIpStripRfc directly calls r00t2.io/goutils/netx.IpStripRfcStr.
netxIp4MaskCidrfunc netxIp4MaskCidr(ipMask net.IPMask) (cidr uint8, err error)
+netxIp4MaskCidr directly calls r00t2.io/goutils/netx.IPMask4ToCidr.
netxIp4MaskMaskfunc netxIp4MaskMask(ipMask net.IPMask) (mask uint32, err error)
+netxIp4MaskMask directly calls r00t2.io/goutils/netx.IPMask4ToMask.
numFloat32StrnumFloat32StrnumFloat64numFloat64numFloat64StrnumFloat64StrnumFloatStrnumFloatStrosFQDNosFQDNosGroupByIdosGroupByIdstring or an
osGroupByNameosGroupByNamestring or an
osHostosHostosHostnameosHostnameosIdStateosIdStateosUserosUserosUserByIdosUserByIdstring or an
osUserByNameosUserByNamestring or an
These operate similar to the path stdlib library and use a fixed / path separator.
pathJoinpathJoinpathPipeJoinpathPipeJoinpathSliceJoinpathSliceJoinpathSlicePipeJoinpathSlicePipeJoin[]string) to append to that base path.
pathSubJoinpathSubJoin[]string) to append to that base path.
These operate similar to the path/filepath stdlib library, and use the OS-specific os.PathSeparator.
[]string) to append to that base path.
osPathJoinosPathJoinosPathPipeJoinosPathPipeJoinosPathSeposPathSeposPathSliceJoinosPathSliceJoinosPathSlicePipeJoinosPathSlicePipeJoinosPathSubJoinosPathSubJoinThese are functions from github.com/shirou/gopsutil/v4 packages.
psCpuCntspsCpuCntspsCpuInfopsCpuInfopsCpuPctpsCpuPctpsCpuTimespsCpuTimespsDiskIoCntspsDiskIoCntspsDiskLabelpsDiskLabelpsDiskPartspsDiskPartspsDiskSerialpsDiskSerialpsDiskUsagepsDiskUsagepsHostBootpsHostBootpsHostIdpsHostIdpsHostInfopsHostInfopsHostKernArchpsHostKernArchpsHostKernVerpsHostKernVerpsHostPlatInfopsHostPlatInfopsHostPlatUptimepsHostPlatUptimepsHostUserspsHostUserspsHostPlatVirtpsHostPlatVirtpsLoadAvgpsLoadAvgpsLoadMiscpsLoadMiscpsMemExVMempsMemExVMempsMemSwappsMemSwappsMemSwapDevspsMemSwapDevspsMemVMempsMemVMempsNetConnspsNetConnspsNetConnsMaxpsNetConnsMaxpsNetConnsPidpsNetConnsPidpsNetConnsPidMaxpsNetConnsPidMaxpsNetCTStatspsNetCTStatspsNetCTStatListpsNetCTStatListpsNetFilterCntspsNetFilterCntspsNetIoCntspsNetIoCntspsNetIoCntsFilepsNetIoCntsFilepsNetIfacespsNetIfacespsNetPidspsNetPidspsNetProtoCntpsNetProtoCntpsNetRevpsNetRevpsProcspsProcspsProcNewpsProcNewpsProcPidspsProcPidspsProcPidExistspsProcPidExistspsSensorExTemppsSensorExTemppsSensorTempspsSensorTempspsWinsvcListpsWinsvcListpsWinsvcNewpsWinsvcNewextIndentextIndentsysArchsysArchsysNumCpusysNumCpusysOsNamesysOsNamesysRuntimesysRuntimetmDatetmDatetmFloatMicrotmFloatMicrotmFloatMillitmFloatMillitmFloatNanotmFloatNanotmFloattmFloattmFmttmFmttmNowtmNowtmParseDur8ntmParseDur8ntmParseMonthtmParseMonthtmParseMonthInttmParseMonthInttmParseMonthStrtmParseMonthStrtmParseTimetmParseTime