sprig library
(Go docs).
Tip
|
If 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. Be sure to view it at properly via the AsciiDoc rendering or by downloading and viewing the HTML version and/or PDF version. |
CombinedFuncMap
github.com/Masterminds/sprig/v3.GenericFuncMap.
CombinedHtmlFuncMap
github.com/Masterminds/sprig/v3.HtmlFuncMap.
CombinedTxtFuncMap
github.com/Masterminds/sprig/v3.TxtFuncMap.
FuncMap
HtmlFuncMap
html/template.FuncMap.
Nop
TxtFuncMap
text/template.FuncMap.
dump
github.com/davecgh/go-spew/spew.Sdump
for whatever object(s) is/are passed to it.
metaIsNil
text/template.IsTrue and
html/template.IsTrue (expressed in
templates as `{{ if … }}`) leaves, as those functions/expressions return
false for e.g. `false` booleans AND nils.
net
net.
netCidrMask
net.CIDRMask.
netExtractAddr
net.ParseCIDR and returns the
net.IP component.
netExtractHost
net.SplitHostPort and returns the host
component (as a string).
netExtractIpnet
net.ParseCIDR and returns the
net.IPNet component.
netExtractPort
net.SplitHostPort and returns the port
component (as a uint16).
netIfaces
net.Interfaces.
netIp4Mask
net.IPv4Mask.
netJoinHostPort
net.JoinHostPort.
netParseIP
net.ParseIP.
net/netip
net/netip.
netipAddrPort
net/netip.AddrPortFrom.
netipParseAddr
net/netip.ParseAddr.
netipParseAddrPort
net/netip.ParseAddrPort.
netipParsePrefix
net/netip.ParsePrefix.
netipPrefix
net/netip.PrefixFrom.
go4.org/netipx
go4.org/netipx.
netipxAddrIpNet
go4.org/netipx.AddrIPNet.
netipxCmpPfx
go4.org/netipx.ComparePrefix.
netipxFromStdAddr
go4.org/netipx.FromStdAddr. Instead of
returning a boolean as the second value, it will instead be an error if
the wrapped boolean is false.
netipxFromIp
go4.org/netipx.FromStdIP. Instead of
returning a boolean as the second value, it will instead be an error if
the wrapped boolean is false.
netipxFromIpNet
go4.org/netipx.FromStdIPNet. Instead of
returning a boolean as the second value, it will instead be an error if
the wrapped boolean is false.
netipxParseRange
go4.org/netipx.ParseIPRange.
netipxPfxAddr
go4.org/netipx.ParsePrefixOrAddr.
netipxPfxIpNet
go4.org/netipx.PrefixIPNet.
netipxPfxLast
go4.org/netipx.PrefixLastIP.
netipxPfxRange
go4.org/netipx.RangeOfPrefix.
netipxRange
go4.org/netipx.IPRangeFrom.
numFloat32Str
numFloat64
numFloat64Str
numFloatStr
osFQDN
os.Hostname.
os.Hostname, use
[`osHostname`](#fn_os_hstnm).
osGroupById
os/user.Group from a given group ID/GID.
os/user.LookupGroupId, except it will
accept either a `string` **or** an `int` as the GID.
osGroupByName
os/user.Group from a given group name.
os/user.LookupGroup.
osHost
os.Hostname and returning the first
"host label" (as RFCs refer to it). This is commonly/colloquially called
the "hostname" or "hostname without the domain part".
Tip
|
The |
os.Hostname, use
[`osHostname`](#fn_os_hstnm).
osHostname
os.Hostname.
osIdState
r00t2.io/sysutils.IDState.
r00t2.io/sysutils.GetIDState.
Warning
|
This is more or less useless on Windows; it returns only a dummy struct for cross-platform compatibility. |
osUser
os/user.User.
os/user.Current.
osUserById
os/user.User from a given user ID/UID.
os/user.LookupId, except it will accept
either a `string` **or** an `int` as the UID.
osUserByName
os/user.User from a given username.
os/user.Lookup.
path stdlib library and use a fixed `/` path separator.
pathJoin
path.Join.
Warning
|
If you are joining paths in a pipeline, you almost assuredly want |
pathPipeJoin
pathSliceJoin
Tip
|
The |
pathSlicePipeJoin
Tip
|
The |
pathSubJoin
path/filepath stdlib library, and
use the OS-specific
os.PathSeparator.
Warning
|
Take special note of the oddness around specifying Windows paths and
drive letters in e.g. It is recommended to make use of |
osPathJoin
path/filepath.Join.
Warning
|
If you are joining paths in a pipeline, you almost assuredly want |
| OS | Result |
|---|---|
Windows |
|
Others (e.g. Linux, macOS) |
|
osPathPipeJoin
| OS | Result |
|---|---|
Windows |
|
Others (e.g. Linux, macOS) |
|
osPathSep
os.PathSeparator for this OS.
| OS | Result |
|---|---|
Windows |
|
Others (e.g. Linux, macOS) |
|
osPathSliceJoin
Tip
|
The |
| OS | Result |
|---|---|
Windows |
|
Others (e.g. Linux, macOS) |
|
osPathSlicePipeJoin
Tip
|
The |
| OS | Result |
|---|---|
Windows |
|
Others (e.g. Linux, macOS) |
|
osPathSubJoin
| OS | Result |
|---|---|
Windows |
|
Others (e.g. Linux, macOS) |
|
github.com/shirou/gopsutil/v4 packages.
psCpuCnts
github.com/shirou/gopsutil/v4/cpu.Counts.
psCpuInfo
github.com/shirou/gopsutil/v4/cpu.Info.
psCpuPct
github.com/shirou/gopsutil/v4/cpu.Percent.
psCpuTimes
github.com/shirou/gopsutil/v4/cpu.Times.
psDiskIoCnts
github.com/shirou/gopsutil/v4/disk.IOCounters.
psDiskLabel
github.com/shirou/gopsutil/v4/disk.Label.
psDiskParts
github.com/shirou/gopsutil/v4/disk.Partitions.
psDiskSerial
github.com/shirou/gopsutil/v4/disk.SerialNumber.
psDiskUsage
github.com/shirou/gopsutil/v4/disk.Usage.
psHostBoot
github.com/shirou/gopsutil/v4/host.BootTime.
psHostId
github.com/shirou/gopsutil/v4/host.HostID.
psHostInfo
github.com/shirou/gopsutil/v4/host.Info.
psHostKernArch
github.com/shirou/gopsutil/v4/host.KernelArch.
psHostKernVer
github.com/shirou/gopsutil/v4/host.KernelVersion.
psHostPlatInfo
github.com/shirou/gopsutil/v4/host.PlatformInformation.
psHostPlatUptime
github.com/shirou/gopsutil/v4/host.Uptime.
psHostUsers
github.com/shirou/gopsutil/v4/host.Users.
psHostPlatVirt
github.com/shirou/gopsutil/v4/host.Virtualization.
psLoadAvg
github.com/shirou/gopsutil/v4/load.Avg.
psLoadMisc
github.com/shirou/gopsutil/v4/load.Misc.
psMemExVMem
Warning
|
This function is available on Windows and Linux platforms only. |
Warning
|
This function returns very different types depending on platform.
|
psMemSwap
github.com/shirou/gopsutil/v4/mem.SwapMemory.
psMemSwapDevs
github.com/shirou/gopsutil/v4/mem.SwapDevices.
psMemVMem
github.com/shirou/gopsutil/v4/mem.VirtualMemory.
psNetConns
github.com/shirou/gopsutil/v4/net.Connections.
psNetConnsMax
github.com/shirou/gopsutil/v4/net.ConnectionsMax.
psNetConnsPid
github.com/shirou/gopsutil/v4/net.ConnectionsPid.
psNetConnsPidMax
github.com/shirou/gopsutil/v4/net.ConnectionsPidMax.
psNetCTStats
github.com/shirou/gopsutil/v4/net.ConntrackStats.
psNetCTStatList
github.com/shirou/gopsutil/v4/net.ConntrackStatList.
psNetFilterCnts
github.com/shirou/gopsutil/v4/net.FilterCounters.
psNetIoCnts
github.com/shirou/gopsutil/v4/net.IOCounters.
psNetIoCntsFile
github.com/shirou/gopsutil/v4/net.IOCountersByFile.
psNetIfaces
github.com/shirou/gopsutil/v4/net.Interfaces.
psNetPids
github.com/shirou/gopsutil/v4/net.Pids.
psNetProtoCnt
Warning
|
This only works properly on Linux currently per upstream. |
github.com/shirou/gopsutil/v4/net.ProtoCounters.
psNetRev
Warning
|
This function only exists on Linux. |
github.com/shirou/gopsutil/v4/net.Reverse.
psProcs
github.com/shirou/gopsutil/v4/proc.Processes.
psProcNew
github.com/shirou/gopsutil/v4/proc.NewProcess.
psProcPids
github.com/shirou/gopsutil/v4/proc.Pids.
psProcPidExists
github.com/shirou/gopsutil/v4/proc.PidExists.
psSensorExTemp
Warning
|
This function only exists on Linux. |
psSensorTemps
github.com/shirou/gopsutil/v4/sensors.SensorsTemperatures.
Warning
|
All of these functions are only available on Windows. |
psWinsvcList
Warning
|
This function is only available on Windows. |
github.com/shirou/gopsutil/v4/winservices.ListServices.
psWinsvcNew
Warning
|
This function is only available on Windows. |
github.com/shirou/gopsutil/v4/winservices.NewService.
extIndent
Tip
|
If |
| Argument | Type | Description |
|---|---|---|
|
|
The level of indentation for the text. If less than or equal to
|
|
|
If true, skip indenting the first line. This is particularly handy if you like to visually align your function calls in your templates. |
|
|
If true, do not add an indent to empty lines (where an "empty line" means "only has a linebreak"). |
|
|
If true, do not add an indent to lines that only consist of whitespace (spaces, tabs, etc.) and a linebreak. |
|
|
The string to use as the "indent character". This can be any string,
such as |
|
|
The text to be indented. Because it is the last argument,
|
sysArch
runtime.GOARCH constant.
sysNumCpu
runtime.NumCPU.
sysOsName
runtime.GOOS constant.
sysRuntime
runtime stdlib library.
Tip
|
The value type is a direct link to the Because all values are mapped as strings, they can be converted back to their native type via e.g. the Sprig conversion functions if necessary. |
Note
|
Some of these functions duplicate Sprig functionality, but are included here for predictable API. Care has been taken to name these functions differently from the Sprig functions where possible and sensible. |
tmDate
time.Date.
tmFloatMicro
(r00t2.io/goutils/timex).F64Microseconds.
tmFloatMilli
(r00t2.io/goutils/timex).F64Milliseconds.
tmFloatNano
(r00t2.io/goutils/timex).F64Nanoseconds.
tmFloat
(r00t2.io/goutils/timex).F64Seconds.
tmFmt
tmNow
time.Now.
tmParseDur8n
time.ParseDuration.
tmParseMonth
tmParseMonthInt
time.Month. `n` may be any numeric type
or a string representation of a number (or a custom type derived from
those).
time.Month constants in the `time`
module:
time.Now).
errors.Is; it will be wrapped by
[`(text/template).ExecError`](https://pkg.go.dev/text/template#ExecError)/[`(html/template).ExecError`](https://pkg.go.dev/html/template#ExecError).
tmParseMonthStr
time.Month.
time.Now).
tmParseTime
time.Parse.