Files
go_goutils/tplx/sprigx/README.md
brent saner 07e0e587fa v1.16.4
ADDED:
* math, time functions to tplx/sprigx
FIXED:
* logging not initializing properly on some BSDs
2026-01-30 06:35:23 -05:00

5304 lines
91 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<div id="header">
# SprigX
<div class="details">
<span id="author" class="author">Brent Saner</span>
<span id="email" class="email"><bts@square-r00t.net></span>
<span id="revdate">Last rendered 2026-01-30 06:35:11 -0500</span>
</div>
<div id="toc" class="toc2">
<div id="toctitle">
Table of Contents
</div>
- [1. What is SprigX?](#wat)
- [2. How do I Use SprigX?](#use)
- [3. Library Functions](#lib)
- [3.1. `CombinedFuncMap`](#lib_cmbfmap)
- [3.2. `CombinedHtmlFuncMap`](#lib_cmbhfmap)
- [3.3. `CombinedTxtFuncMap`](#lib_cmbtfmap)
- [3.4. `FuncMap`](#lib_fmap)
- [3.5. `HtmlFuncMap`](#lib_hfmap)
- [3.5.1. `Nop`](#lib_nop)
- [3.6. `TxtFuncMap`](#lib_tfmap)
- [4. Template Functions](#fn)
- [4.1. Debugging](#fn_dbg)
- [4.1.1. `dump`](#fn_dbg_dump)
- [4.2. "Meta"/Template Helpers](#fn_meta)
- [4.2.1. `metaIsNil`](#fn_meta_isnil)
- [4.3. Numbers/Math](#fn_num)
- [4.3.1. `numFloat32Str`](#fn_num_f32s)
- [4.3.2. `numFloat64`](#fn_num_f64)
- [4.3.3. `numFloat64Str`](#fn_num_f64s)
- [4.3.4. `numFloatStr`](#fn_num_fs)
- [4.4. Operating System](#fn_os)
- [4.4.1. `osFQDN`](#fn_os_fqdn)
- [4.4.2. `osGroupById`](#fn_os_grpid)
- [4.4.3. `osGroupByName`](#fn_os_grpnm)
- [4.4.4. `osHost`](#fn_os_hst)
- [4.4.5. `osHostname`](#fn_os_hstnm)
- [4.4.6. `osIdState`](#fn_os_idst)
- [4.4.7. `osUser`](#fn_os_usr)
- [4.4.8. `osUserById`](#fn_os_usrid)
- [4.4.9. `osUserByName`](#fn_os_usrnm)
- [4.5. Paths](#fn_path)
- [4.5.1. Generic](#fn_path_gnrc)
- [4.5.1.1. `pathJoin`](#fn_path_gnrc_pj)
- [4.5.1.2. `pathPipeJoin`](#fn_path_gnrc_ppj)
- [4.5.1.3. `pathSliceJoin`](#fn_path_gnrc_psj)
- [4.5.1.4. `pathSlicePipeJoin`](#fn_path_gnrc_pspj)
- [4.5.1.5. `pathSubJoin`](#fn_path_gnrc_psubj)
- [4.5.2. OS/Platform-Tailored](#fn_path_os)
- [4.5.2.1. `osPathJoin`](#fn_path_os_pj)
- [4.5.2.2. `osPathPipeJoin`](#fn_path_os_ppj)
- [4.5.2.3. `osPathSep`](#fn_path_ossep)
- [4.5.2.4. `osPathSliceJoin`](#fn_path_os_psj)
- [4.5.2.5. `osPathSlicePipeJoin`](#fn_path_os_pspj)
- [4.5.2.6. `osPathSubJoin`](#fn_path_os_psubj)
- [4.6. PSUtil](#fn_ps)
- [4.6.1. CPU/Processor](#fn_ps_cpu)
- [4.6.1.1. `psCpuCnts`](#fn_ps_cpu_cnts)
- [4.6.1.2. `psCpuInfo`](#fn_ps_cpu_info)
- [4.6.1.3. `psCpuPct`](#fn_ps_cpu_pct)
- [4.6.1.4. `psCpuTimes`](#fn_ps_cpu_tms)
- [4.6.2. Disk](#fn_ps_dsk)
- [4.6.2.1. `psDiskIoCnts`](#fn_ps_dsk_iocnts)
- [4.6.2.2. `psDiskLabel`](#fn_ps_dsk_lbl)
- [4.6.2.3. `psDiskParts`](#fn_ps_dsk_parts)
- [4.6.2.4. `psDiskSerial`](#fn_ps_dsk_srl)
- [4.6.2.5. `psDiskUsage`](#fn_ps_dsk_usg)
- [4.6.3. Host](#fn_ps_hst)
- [4.6.3.1. `psHostBoot`](#fn_ps_hst_boot)
- [4.6.3.2. `psHostId`](#fn_ps_hst_id)
- [4.6.3.3. `psHostInfo`](#fn_ps_hst_info)
- [4.6.3.4. `psHostKernArch`](#fn_ps_hst_krnarch)
- [4.6.3.5. `psHostKernVer`](#fn_ps_hst_krnver)
- [4.6.3.6. `psHostPlatInfo`](#fn_ps_hst_plat)
- [4.6.3.7. `psHostPlatUptime`](#fn_ps_hst_uptm)
- [4.6.3.8. `psHostUsers`](#fn_ps_hst_usrs)
- [4.6.3.9. `psHostPlatVirt`](#fn_ps_hst_virt)
- [4.6.4. Load](#fn_ps_ld)
- [4.6.4.1. `psLoadAvg`](#fn_ps_ld_avg)
- [4.6.4.2. `psLoadMisc`](#fn_ps_ld_misc)
- [4.6.5. Memory](#fn_ps_mem)
- [4.6.5.1. `psMemExVMem`](#fn_ps_mem_exvmem)
- [4.6.5.2. `psMemSwap`](#fn_ps_mem_swap)
- [4.6.5.3. `psMemSwapDevs`](#fn_ps_mem_swapdevs)
- [4.6.5.4. `psMemVMem`](#fn_ps_mem_vmem)
- [4.6.6. Network](#fn_ps_net)
- [4.6.6.1. `psNetConns`](#fn_ps_net_conns)
- [4.6.6.2. `psNetConnsMax`](#fn_ps_net_connsmax)
- [4.6.6.3. `psNetConnsPid`](#fn_ps_net_connspid)
- [4.6.6.4. `psNetConnsPidMax`](#fn_ps_net_connspidmax)
- [4.6.6.5. `psNetCTStats`](#fn_ps_net_ct)
- [4.6.6.6. `psNetCTStatList`](#fn_ps_net_ctlist)
- [4.6.6.7. `psNetFilterCnts`](#fn_ps_net_fltcnt)
- [4.6.6.8. `psNetIoCnts`](#fn_ps_net_iocnts)
- [4.6.6.9. `psNetIoCntsFile`](#fn_ps_net_iocntsfl)
- [4.6.6.10. `psNetIfaces`](#fn_ps_net_ifaces)
- [4.6.6.11. `psNetPids`](#fn_ps_net_pids)
- [4.6.6.12. `psNetProtoCnt`](#fn_ps_net_protocnts)
- [4.6.6.13. `psNetRev`](#fn_ps_net_rev)
- [4.6.7. Processes](#fn_ps_proc)
- [4.6.7.1. `psProcs`](#fn_ps_procs_procs)
- [4.6.7.2. `psProcNew`](#fn_ps_proc_new)
- [4.6.7.3. `psProcPids`](#fn_ps_proc_pids)
- [4.6.7.4. `psProcPidExists`](#fn_ps_proc_pidxst)
- [4.6.8. Sensors/Thermals](#fn_ps_sns)
- [4.6.8.1. `psSensorExTemp`](#fn_ps_sns_extemp)
- [4.6.8.2. `psSensorTemps`](#fn_ps_sns_temps)
- [4.6.9. Windows Services](#fn_ps_winsvc)
- [4.6.9.1. `psWinsvcList`](#fn_ps_winsvc_list)
- [4.6.9.2. `psWinsvcNew`](#fn_ps_winsvc_new)
- [4.7. Strings](#fn_str)
- [4.7.1. `extIndent`](#fn_str_extindent)
- [4.8. Time/Dates/Timestamps](#fn_tm)
- [4.8.1. `tmDate`](#fn_tm_date)
- [4.8.2. `tmFloatMicro`](#fn_tm_fltmic)
- [4.8.3. `tmFloatMilli`](#fn_tm_fltmill)
- [4.8.4. `tmFloatNano`](#fn_tm_fltnano)
- [4.8.5. `tmFloat`](#fn_tm_flt)
- [4.8.6. `tmFmt`](#fn_tm_fmt)
- [4.8.7. `tmNow`](#fn_tm_now)
- [4.8.8. `tmParseDur8n`](#fn_tm_pdur8n)
- [4.8.9. `tmParseMonth`](#fn_tm_pmnth)
- [4.8.10. `tmParseMonthInt`](#fn_tm_pmnthi)
- [4.8.11. `tmParseMonthStr`](#fn_tm_pmnths)
- [4.8.12. `tmParseTime`](#fn_tm_ptm)
- [4.9. System/Platform/Architecture](#fn_sys)
- [4.9.1. `sysArch`](#fn_sys_arch)
- [4.9.2. `sysNumCpu`](#fn_sys_numcpu)
- [4.9.3. `sysOsName`](#fn_sys_os)
- [4.9.4. `sysRuntime`](#fn_sys_rntm)
</div>
</div>
<div id="content">
<div class="sect1">
## <a href="#wat" class="link">1. What is SprigX?</a>
<div class="sectionbody">
<div class="paragraph">
SprigX is a suite of extensions to
<a href="https://masterminds.github.io/sprig/" target="_blank"
rel="noopener">the <code>sprig</code> library</a>
(<a href="https://pkg.go.dev/github.com/Masterminds/sprig/v3"
target="_blank" rel="noopener">Go docs</a>).
</div>
<div class="paragraph">
They provide functions that offer more enriched use cases and
domain-specific data.
</div>
<div class="admonitionblock tip">
<table>
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<tbody>
<tr>
<td class="icon"><div class="title">
Tip
</div></td>
<td class="content"><div class="paragraph">
<p>If you are reading this README on the Go Module Directory
documentation (<a href="https://pkg.go.dev/r00t2.io/goutils/tplx/sprigx"
class="bare">https://pkg.go.dev/r00t2.io/goutils/tplx/sprigx</a>) or the
directory landing page (<a
href="https://git.r00t2.io/r00t2/go_goutils/src/branch/master/tplx/sprigx"
class="bare">https://git.r00t2.io/r00t2/go_goutils/src/branch/master/tplx/sprigx</a>),
it may not render correctly.</p>
</div>
<div class="paragraph">
<p>Be sure to view it at properly via <a
href="https://git.r00t2.io/r00t2/go_goutils/src/branch/master/tplx/sprigx/README.adoc"
target="_blank" rel="noopener">the AsciiDoc rendering</a> or by
downloading and viewing the <a
href="https://git.r00t2.io/r00t2/go_goutils/raw/branch/master/tplx/sprigx/README.html"
target="_blank" rel="noopener">HTML version</a>.</p>
</div></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="sect1">
## <a href="#use" class="link">2. How do I Use SprigX?</a>
<div class="sectionbody">
<div class="paragraph">
The same way you would `sprig`!
</div>
Like this.
<div class="content">
<div class="listingblock">
<div class="content">
``` rouge
package main
import (
htmlTplLib "html/template"
txtTplLib "text/template"
"r00t2.io/goutils/tplx/sprigx"
)
var (
txtTpl *txtTplLib.Template = txtTplLib.
New("").
Funcs(
sprigx.TxtFuncMap(),
)
htmlTpl *htmlTplLib.Template = htmlTplLib.
New("").
Funcs(
sprigx.HtmlFuncMap(),
)
)
```
</div>
</div>
</div>
<div class="paragraph">
They can even be combined/used together.
</div>
Like this.
<div class="content">
<div class="listingblock">
<div class="content">
``` rouge
package main
import (
"text/template"
"github.com/Masterminds/sprig/v3"
"r00t2.io/goutils/tplx/sprigx"
)
var txtTpl *template.Template = template.
New("").
Funcs(
sprigx.TxtFuncMap(),
).
Funcs(
sprig.TxtFuncMap(),
)
// Or:
/*
var txtTpl *template.Template = template.
New("").
Funcs(
sprig.TxtFuncMap(),
).
Funcs(
sprigx.TxtFuncMap(),
)
*/
```
</div>
</div>
</div>
<div class="paragraph">
Or, as a convenience, you can simply use the
[`sprigx.CombinedTxtFuncMap`](#lib_cmbtfmap) and/or
[`sprigx.CombinedHtmlFuncMap`](#lib_cmbhfmap) functions.
</div>
<div class="paragraph">
If a `<template>.FuncMap` is added via `.Funcs()` **after** template
parsing, it will override any functions of the same name of a
`<template>.FuncMap` **before** parsing.
</div>
<div class="paragraph">
For example, if both `sprig` and `sprigx` provide a function `foo`:
</div>
<div class="paragraph">
this will use `foo` from `sprigx`
</div>
(show)
<div class="content">
<div class="listingblock">
<div class="content">
``` rouge
package main
import (
"text/template"
"github.com/Masterminds/sprig/v3"
"r00t2.io/goutils/tplx/sprigx"
)
const (
myTpl string = `{{ "This is an example template string." | foo }}`
)
var (
tpl *template.Template = template.Must(
template.
New("").
Funcs(sprig.TxtFuncMap()).
Parse(myTpl),
).
Funcs(sprigx.TxtFuncMap())
)
```
</div>
</div>
</div>
<div class="paragraph">
whereas this will use `foo` from `sprig`
</div>
(show)
<div class="content">
<div class="listingblock">
<div class="content">
``` rouge
package main
import (
"text/template"
"github.com/Masterminds/sprig/v3"
"r00t2.io/goutils/tplx/sprigx"
)
const (
myTpl string = `{{ "This is an example template string." | foo }}`
)
var (
tpl *template.Template = template.Must(
template.
New("").
Funcs(sprigx.TxtFuncMap()).
Parse(myTpl),
).
Funcs(sprig.TxtFuncMap())
)
```
</div>
</div>
</div>
<div class="paragraph">
and a function can even be explicitly
<span id="override"></span>overridden.
</div>
(show)
<div class="content">
<div class="paragraph">
This would override a function `foo` and `foo2` in `sprigx` from `foo`
and `foo2` from `sprig`, but leave all other `sprig` functions
untouched.
</div>
<div class="listingblock">
<div class="content">
``` rouge
package main
import (
"text/template"
"github.com/Masterminds/sprig/v3"
"r00t2.io/goutils/tplx/sprigx"
)
const (
myTpl string = `{{ "This is an example template string." | foo }}`
)
var (
overrideFuncs template.FuncMap = sprig.TxtFuncMap()
tpl *template.Template = template.Must(
template.
New("").
Funcs(sprigx.TxtFuncMap()).
Parse(myTpl),
).
Funcs(
template.FuncMap(
map[string]any{
"foo": overrideFuncs["foo"],
"foo2": overrideFuncs["foo2"],
},
),
)
)
```
</div>
</div>
</div>
</div>
</div>
<div class="sect1">
## <a href="#lib" class="link">3. Library Functions</a>
<div class="sectionbody">
<div class="paragraph">
These are generally intended to be used **outside** the template in the
actual Go code.
</div>
<div class="sect2">
### <a href="#lib_cmbfmap" class="link">3.1.
<code>CombinedFuncMap</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func CombinedFuncMap(preferSprigX bool) (fmap map[string]any)
```
</div>
</div>
<div class="paragraph">
This function returns a generic function map (like
[`FuncMap`](#lib_fmap)) combined with <a
href="https://pkg.go.dev/github.com/Masterminds/sprig/v3#GenericFuncMap"
target="_blank"
rel="noopener"><code>github.com/Masterminds/sprig/v3.GenericFuncMap</code></a>.
</div>
<div class="paragraph">
If `preferSprigx` is true, SprigX function names will override Sprig
functions with the same name. If false, Sprig functions will override
conflicting SprigX functions with the same name.
</div>
<div class="paragraph">
You probably want [`CombinedTxtFuncMap`](#lib_cmbtfmap) or
[`CombinedHtmlFuncMap`](#lib_cmbhfmap) instead, as they wrap this with
the appropriate type.
</div>
</div>
<div class="sect2">
### <a href="#lib_cmbhfmap" class="link">3.2.
<code>CombinedHtmlFuncMap</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func CombinedHtmlFuncMap(preferSprigX bool) (fmap (html/template).FuncMap)
```
</div>
</div>
<div class="paragraph">
This function returns an
[`(html/template).FuncMap`](https://pkg.go.dev/html/template#FuncMap)
function map (like [`HtmlFuncMap`](#lib_hfmap)) combined with
<a href="https://pkg.go.dev/github.com/Masterminds/sprig/v3#HtmlFuncMap"
target="_blank"
rel="noopener"><code>github.com/Masterminds/sprig/v3.HtmlFuncMap</code></a>.
</div>
<div class="paragraph">
If `preferSprigx` is true, SprigX function names will override Sprig
functions with the same name. If false, Sprig functions will override
conflicting SprigX functions with the same name.
</div>
</div>
<div class="sect2">
### <a href="#lib_cmbtfmap" class="link">3.3.
<code>CombinedTxtFuncMap</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func CombinedTxtFuncMap(preferSprigX bool) (fmap (text/template).FuncMap)
```
</div>
</div>
<div class="paragraph">
This function returns a
[`(text/template).FuncMap`](https://pkg.go.dev/text/template#FuncMap)
function map (like [`TxtFuncMap`](#lib_tfmap)) combined with
<a href="https://pkg.go.dev/github.com/Masterminds/sprig/v3#TxtFuncMap"
target="_blank"
rel="noopener"><code>github.com/Masterminds/sprig/v3.TxtFuncMap</code></a>.
</div>
<div class="paragraph">
If `preferSprigx` is true, SprigX function names will override Sprig
functions with the same name. If false, Sprig functions will override
conflicting SprigX functions with the same name.
</div>
</div>
<div class="sect2">
### <a href="#lib_fmap" class="link">3.4. <code>FuncMap</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func FuncMap() (fmap map[string]any)
```
</div>
</div>
<div class="paragraph">
This function returns a generic SprigX function map.
</div>
<div class="paragraph">
You probably want [`TxtFuncMap`](#lib_tfmap) or
[`HtmlFuncMap`](#lib_hfmap) instead, as they wrap this with the
appropriate type.
</div>
</div>
<div class="sect2">
### <a href="#lib_hfmap" class="link">3.5. <code>HtmlFuncMap</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func HtmlFuncMap() (fmap (html/template).FuncMap)
```
</div>
</div>
<div class="paragraph">
This function returns a SprigX
<a href="https://pkg.go.dev/html/template#FuncMap" target="_blank"
rel="noopener"><code>(html/template).FuncMap</code></a>.
</div>
<div class="sect3">
#### <a href="#lib_nop" class="link">3.5.1. <code>Nop</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func Nop(obj ...any) (s string)
```
</div>
</div>
<div class="paragraph">
`Nop` is a NO-OP function that one can use in an [override
map](#override) to explicitly disable certain Sprig/SprigX functions
that may be deemed "unsafe" and/or to sanitize templates from untrusted
input.
</div>
<div class="paragraph">
It will **never** error or panic, and `s` is **always** an empty string.
</div>
</div>
</div>
<div class="sect2">
### <a href="#lib_tfmap" class="link">3.6. <code>TxtFuncMap</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func TxtFuncMap() (fmap (text/template).FuncMap)
```
</div>
</div>
<div class="paragraph">
This function returns a SprigX
<a href="https://pkg.go.dev/text/template#FuncMap" target="_blank"
rel="noopener"><code>(text/template).FuncMap</code></a>.
</div>
</div>
</div>
</div>
<div class="sect1">
## <a href="#fn" class="link">4. Template Functions</a>
<div class="sectionbody">
<div class="paragraph">
Expect this list to grow over time, and potentially more frequently than
the `sprigx` functions.
</div>
<div class="paragraph">
Each function includes its function signature to indicate what types of
arguments/parameters it accepts, what it returns, and if it may
potentially return an error or not.
</div>
<div class="sect2">
### <a href="#fn_dbg" class="link">4.1. Debugging</a>
<div class="sect3">
#### <a href="#fn_dbg_dump" class="link">4.1.1. <code>dump</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func dump(a ...interface{}) (out string)
```
</div>
</div>
<div class="paragraph">
The `dump` function directly calls
<a href="https://pkg.go.dev/github.com/davecgh/go-spew/spew#Sdump"
target="_blank"
rel="noopener"><code>github.com/davecgh/go-spew/spew.Sdump</code></a>
for whatever object(s) is/are passed to it.
</div>
</div>
</div>
<div class="sect2">
### <a href="#fn_meta" class="link">4.2. "Meta"/Template Helpers</a>
<div class="sect3">
#### <a href="#fn_meta_isnil" class="link">4.2.1. <code>metaIsNil</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func metaIsNil(obj any) (isNil bool)
```
</div>
</div>
<div class="paragraph">
`metaIsNil` returns `true` if `obj` is explicitly nil, otherwise it
returns false.
</div>
<div class="paragraph">
This function fills in the gap that
<a href="https://pkg.go.dev/text/template#IsTrue" target="_blank"
rel="noopener"><code>text/template.IsTrue</code></a> and
<a href="https://pkg.go.dev/html/template#IsTrue" target="_blank"
rel="noopener"><code>html/template.IsTrue</code></a> (expressed in
templates as `{{ if …​ }}`) leaves, as those functions/expressions return
false for e.g. `false` booleans AND nils.
</div>
</div>
</div>
<div class="sect2">
### <a href="#fn_num" class="link">4.3. Numbers/Math</a>
<div class="sect3">
#### <a href="#fn_num_f32s" class="link">4.3.1.
<code>numFloat32Str</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func numFloat32Str(f float32) (s string)
```
</div>
</div>
<div class="paragraph">
`numFloat32Str` returns a **complete** non-truncated non-right-padded
string representation of a `float32`.
</div>
</div>
<div class="sect3">
#### <a href="#fn_num_f64" class="link">4.3.2. <code>numFloat64</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func numFloat64(val any) (f float64, err error)
```
</div>
</div>
<div class="paragraph">
`numFloat64` returns any string representation of a numeric value or any
type of numeric value to a `float64`.
</div>
</div>
<div class="sect3">
#### <a href="#fn_num_f64s" class="link">4.3.3.
<code>numFloat64Str</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func numFloat64Str(f float64) (s string)
```
</div>
</div>
<div class="paragraph">
`numFloat64Str` returns a **complete** non-truncated non-right-padded
string representation of a `float64`.
</div>
</div>
<div class="sect3">
#### <a href="#fn_num_fs" class="link">4.3.4. <code>numFloatStr</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func numFloatStr(val any) (s string, err error)
```
</div>
</div>
<div class="paragraph">
`numFloatStr` wraps [`numFloat32Str`](#fn_num_f32s) and
[`numFloat64Str`](#fn_num_f64s).
</div>
<div class="paragraph">
`val` can be a string representation of any numeric value or any type of
numeric value.
</div>
</div>
</div>
<div class="sect2">
### <a href="#fn_os" class="link">4.4. Operating System</a>
<div class="sect3">
#### <a href="#fn_os_fqdn" class="link">4.4.1. <code>osFQDN</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func osFQDN() (fqdn string, err error)
```
</div>
</div>
<div class="paragraph">
`osFQDN` currently just directly calls
<a href="https://pkg.go.dev/os#Hostname" target="_blank"
rel="noopener"><code>os.Hostname</code></a>.
</div>
<div class="paragraph">
As such, it comes with the same caveatsnamely that it isnt
guaranteed to be an FQDN, it will be precisely/exactly whatever the
kernel/OS hostname is set as.
</div>
<div class="paragraph">
In the future, it may be extended to support a more diligent effort to
determine an actual FQDN, and return an error if it is unable to be
derived.
</div>
<div class="paragraph">
To (relatively) predictably get the "short hostname", use
[`osHost`](#fn_os_hst). To directly/predictably use
<a href="https://pkg.go.dev/os#Hostname" target="_blank"
rel="noopener"><code>os.Hostname</code></a>, use
[`osHostname`](#fn_os_hstnm).
</div>
</div>
<div class="sect3">
#### <a href="#fn_os_grpid" class="link">4.4.2. <code>osGroupById</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func osGroupById[T string | int](gid T) (g *user.Group, err error)
```
</div>
</div>
<div class="paragraph">
`osGroupById` returns an
<a href="https://pkg.go.dev/os/user#Group" target="_blank"
rel="noopener"><code>os/user.Group</code></a> from a given group ID/GID.
</div>
<div class="paragraph">
It more or less behaves exactly like
<a href="https://pkg.go.dev/os/user#LookupGroupId" target="_blank"
rel="noopener"><code>os/user.LookupGroupId</code></a>, except it will
accept either a `string` **or** an `int` as the GID.
</div>
</div>
<div class="sect3">
#### <a href="#fn_os_grpnm" class="link">4.4.3.
<code>osGroupByName</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func osGroupByName(grpNm string) (g *user.Group, err error)
```
</div>
</div>
<div class="paragraph">
`osGroupByName` returns an
<a href="https://pkg.go.dev/os/user#Group" target="_blank"
rel="noopener"><code>os/user.Group</code></a> from a given group name.
</div>
<div class="paragraph">
It behaves exactly like
<a href="https://pkg.go.dev/os/user#LookupGroup" target="_blank"
rel="noopener"><code>os/user.LookupGroup</code></a>.
</div>
</div>
<div class="sect3">
#### <a href="#fn_os_hst" class="link">4.4.4. <code>osHost</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func osHost() (out string, err error)
```
</div>
</div>
<div class="paragraph">
`osHost` returns the "short hostname" by calling
<a href="https://pkg.go.dev/os#Hostname" target="_blank"
rel="noopener"><code>os.Hostname</code></a> and returning the first
"host label" (as RFCs refer to it).
</div>
<div class="paragraph">
e.g.:
</div>
<div class="listingblock">
<div class="content">
``` rouge
{{- $fqdn := osFQDN -}}
{{- $h := osHost -}}
{{- $cmp := index ($fqdn | splitList ".") 0 -}}
osHost {{ $h }} should be equal to first label of FQDN {{ $cmp }}.
```
</div>
</div>
<div class="admonitionblock tip">
<table>
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<tbody>
<tr>
<td class="icon"><div class="title">
Tip
</div></td>
<td class="content"><div class="paragraph">
<p>The <code>splitList</code> function shown aboce is from the <a
href="https://masterminds.github.io/sprig/string_slice.html"
target="_blank" rel="noopener"><code>sprig</code> string slice
functions</a>.</p>
</div></td>
</tr>
</tbody>
</table>
</div>
<div class="paragraph">
To (try to) get the FQDN, use [`osFQDN`](#fn_os_fqdn). To directly use
<a href="https://pkg.go.dev/os#Hostname" target="_blank"
rel="noopener"><code>os.Hostname</code></a>, use
[`osHostname`](#fn_os_hstnm).
</div>
</div>
<div class="sect3">
#### <a href="#fn_os_hstnm" class="link">4.4.5. <code>osHostname</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func osHostname() (out string, err error)
```
</div>
</div>
<div class="paragraph">
`osHostname` directly calls
<a href="https://pkg.go.dev/os#Hostname" target="_blank"
rel="noopener"><code>os.Hostname</code></a>.
</div>
</div>
<div class="sect3">
#### <a href="#fn_os_idst" class="link">4.4.6. <code>osIdState</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func osIdState() (idst sysutils.IDState)
```
</div>
</div>
<div class="paragraph">
`osIdState` returns the current runtime process'
<a href="https://pkg.go.dev/r00t2.io/sysutils#IDState" target="_blank"
rel="noopener"><code>r00t2.io/sysutils.IDState</code></a>.
</div>
<div class="paragraph">
It directly calls
<a href="https://pkg.go.dev/r00t2.io/sysutils#GetIDState"
target="_blank"
rel="noopener"><code>r00t2.io/sysutils.GetIDState</code></a>.
</div>
<div class="admonitionblock warning">
<table>
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<tbody>
<tr>
<td class="icon"><div class="title">
Warning
</div></td>
<td class="content"><div class="paragraph">
<p>This is more or less useless on Windows; it returns only a dummy
struct for cross-platform compatibility.</p>
</div></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="sect3">
#### <a href="#fn_os_usr" class="link">4.4.7. <code>osUser</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func osUser() (u *user.User, err error)
```
</div>
</div>
<div class="paragraph">
`osUser` returns the current runtime process'
<a href="https://pkg.go.dev/os/user#User" target="_blank"
rel="noopener"><code>os/user.User</code></a>.
</div>
<div class="paragraph">
It directly calls
<a href="https://pkg.go.dev/os/user#Current" target="_blank"
rel="noopener"><code>os/user.Current</code></a>.
</div>
</div>
<div class="sect3">
#### <a href="#fn_os_usrid" class="link">4.4.8. <code>osUserById</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func osUserById[T string | int](uid T) (u *user.User, err error)
```
</div>
</div>
<div class="paragraph">
`osUserById` returns an
<a href="https://pkg.go.dev/os/user#User" target="_blank"
rel="noopener"><code>os/user.User</code></a> from a given user ID/UID.
</div>
<div class="paragraph">
It more or less behaves exactly like
<a href="https://pkg.go.dev/os/user#LookupId" target="_blank"
rel="noopener"><code>os/user.LookupId</code></a>, except it will accept
either a `string` **or** an `int` as the UID.
</div>
</div>
<div class="sect3">
#### <a href="#fn_os_usrnm" class="link">4.4.9. <code>osUserByName</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func osUserByName(userNm string) (u *user.User, err error)
```
</div>
</div>
<div class="paragraph">
`osUserByName` returns an
<a href="https://pkg.go.dev/os/user#User" target="_blank"
rel="noopener"><code>os/user.User</code></a> from a given username.
</div>
<div class="paragraph">
It directly calls
<a href="https://pkg.go.dev/os/user#Lookup" target="_blank"
rel="noopener"><code>os/user.Lookup</code></a>.
</div>
</div>
</div>
<div class="sect2">
### <a href="#fn_path" class="link">4.5. Paths</a>
<div class="sect3">
#### <a href="#fn_path_gnrc" class="link">4.5.1. Generic</a>
<div class="paragraph">
These operate similar to
<a href="https://pkg.go.dev/path" target="_blank" rel="noopener">the
<code>path</code> stdlib library</a> and use a fixed `/` path separator.
</div>
<div class="sect4">
##### <a href="#fn_path_gnrc_pj" class="link">4.5.1.1.
<code>pathJoin</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func pathJoin(elem ...string) (out string)
```
</div>
</div>
<div class="paragraph">
`pathJoin` directly calls
<a href="https://pkg.go.dev/path#Join" target="_blank"
rel="noopener"><code>path.Join</code></a>.
</div>
<div class="admonitionblock warning">
<table>
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<tbody>
<tr>
<td class="icon"><div class="title">
Warning
</div></td>
<td class="content"><div class="paragraph">
<p>If you are joining paths in a pipeline, you almost assuredly want <a
href="#fn_path_gnrc_ppj"><code>pathPipeJoin</code></a> or <a
href="#fn_path_gnrc_pspj"><code>pathSlicePipeJoin</code></a> instead
unless you are explicitly <strong>appending</strong> a pipeline result
to a path.</p>
</div></td>
</tr>
</tbody>
</table>
</div>
<div class="listingblock">
<div class="content">
``` rouge
{{- pathJoin "a" "b" "c" }}
{{- pathJoin "/" "a" "b" "c" }}
{{- pathJoin "/a/b" "c" }}
```
</div>
</div>
<div class="paragraph">
renders as:
</div>
<div class="listingblock">
<div class="content">
``` rouge
a/b/c
/a/b/c
/a/b/c
```
</div>
</div>
</div>
<div class="sect4">
##### <a href="#fn_path_gnrc_ppj" class="link">4.5.1.2.
<code>pathPipeJoin</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func pathPipeJoin(elems ...string) (out string)
```
</div>
</div>
<div class="paragraph">
`pathPipeJoin` operates like [`pathJoin`](#fn_path_gnrc_pj) with one
deviation: the root/base path is expected to be **last** in the
arguments.
</div>
<div class="paragraph">
This makes it much more suitable for use in template pipelines, as the
previous value in a pipeline is passed in as the last element to the
next pipe function.
</div>
<div class="listingblock">
<div class="content">
``` rouge
{{- $myBase := "/a" -}}
{{- pathPipeJoin "b" "c" "a" }}
{{- pathPipeJoin "a" "b" "c" "/" }}
{{- $myBase | pathPipeJoin "b" "c" }}
```
</div>
</div>
<div class="paragraph">
renders as:
</div>
<div class="listingblock">
<div class="content">
``` rouge
a/b/c
/a/b/c
/a/b/c
```
</div>
</div>
</div>
<div class="sect4">
##### <a href="#fn_path_gnrc_psj" class="link">4.5.1.3.
<code>pathSliceJoin</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func pathSliceJoin(sl []string) (out string)
```
</div>
</div>
<div class="paragraph">
`pathSliceJoin` joins a slice of path segment strings (`[]string`)
instead of a variadic sequence of strings.
</div>
<div class="admonitionblock tip">
<table>
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<tbody>
<tr>
<td class="icon"><div class="title">
Tip
</div></td>
<td class="content"><div class="paragraph">
<p>The <code>splitList</code> function shown below is from the <a
href="https://masterminds.github.io/sprig/string_slice.html"
target="_blank" rel="noopener"><code>sprig</code> string slice
functions</a>.</p>
</div></td>
</tr>
</tbody>
</table>
</div>
<div class="listingblock">
<div class="content">
``` rouge
{{- $myList := "a,b,c" | splitList "," -}}
{{- $myList | pathSliceJoin }}
{{- ("a,b,c" | splitList ",") | pathSliceJoin }}
{{- ("/,a,b,c" | splitList ",") | pathSliceJoin }}
```
</div>
</div>
<div class="paragraph">
renders as:
</div>
<div class="listingblock">
<div class="content">
``` rouge
a/b/c
a/b/c
/a/b/c
```
</div>
</div>
</div>
<div class="sect4">
##### <a href="#fn_path_gnrc_pspj" class="link">4.5.1.4.
<code>pathSlicePipeJoin</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func pathSlicePipeJoin(sl []string, root string) (out string)
```
</div>
</div>
<div class="paragraph">
`pathSlicePipeJoin` operates like [`pathPipeJoin`](#fn_path_gnrc_ppj) in
that it is suitable for pipeline use in which the root/base path is
passed in from the pipeline, but it is like
[`pathSliceJoin`](#fn_path_gnrc_psj) in that it then also accepts a
slice of path segments (`[]string`) to append to that base path.
</div>
<div class="admonitionblock tip">
<table>
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<tbody>
<tr>
<td class="icon"><div class="title">
Tip
</div></td>
<td class="content"><div class="paragraph">
<p>The <code>splitList</code> function shown below is from the <a
href="https://masterminds.github.io/sprig/string_slice.html"
target="_blank" rel="noopener"><code>sprig</code> string slice
functions</a>.</p>
</div></td>
</tr>
</tbody>
</table>
</div>
<div class="listingblock">
<div class="content">
``` rouge
{{- $myBase := "/a" -}}
{{- $myList := "b,c,d" | splitList "." -}}
{{- pathSlicePipeJoin $myList $myBase }}
{{- $myBase | pathSlicePipeJoin $myList }}
```
</div>
</div>
<div class="paragraph">
renders as:
</div>
<div class="listingblock">
<div class="content">
``` rouge
/a/b/c
/a/b/c
```
</div>
</div>
</div>
<div class="sect4">
##### <a href="#fn_path_gnrc_psubj" class="link">4.5.1.5.
<code>pathSubJoin</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func pathSubJoin(root string, elems ...string) (out string)
```
</div>
</div>
<div class="paragraph">
`pathSubJoin` operates like [`pathJoin`](#fn_path_gnrc_pj) but it
expects an explicit root/base path.
</div>
<div class="paragraph">
The pipeline-friendly equivalent of this is
[`pathPipeJoin`](#fn_path_gnrc_ppj).
</div>
<div class="listingblock">
<div class="content">
``` rouge
{{- pathSubJoin "/a/b" "c" }}
{{- pathSubJoin "/" "a" "b" "c" }}
{{- "c" | pathSubJoin "/" "a" "b" }}
```
</div>
</div>
<div class="paragraph">
renders as:
</div>
<div class="listingblock">
<div class="content">
``` rouge
/a/b/c
/a/b/c
/a/b/c
```
</div>
</div>
</div>
</div>
<div class="sect3">
#### <a href="#fn_path_os" class="link">4.5.2. OS/Platform-Tailored</a>
<div class="paragraph">
These operate similar to
<a href="https://pkg.go.dev/path/filepath" target="_blank"
rel="noopener">the <code>path/filepath</code> stdlib library</a>, and
use the OS-specific
<a href="https://pkg.go.dev/os#PathSeparator" target="_blank"
rel="noopener"><code>os.PathSeparator</code></a>.
</div>
<div class="admonitionblock warning">
<table>
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<tbody>
<tr>
<td class="icon"><div class="title">
Warning
</div></td>
<td class="content"><div class="paragraph">
<p>Take special note of the oddness around specifying Windows paths and
drive letters in e.g. <a
href="#fn_path_os_pj"><code>osPathJoin</code></a>!</p>
</div>
<div class="paragraph">
<p>It is recommended to make use of <a
href="#fn_sys_os"><code>sysOsName</code></a> to conditionally format
path bases/roots if needed.</p>
</div></td>
</tr>
</tbody>
</table>
</div>
<div class="sect4">
##### <a href="#fn_path_os_pj" class="link">4.5.2.1.
<code>osPathJoin</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func osPathJoin(elem ...string) (out string)
```
</div>
</div>
<div class="paragraph">
`osPathJoin` directly calls
<a href="https://pkg.go.dev/path/filepath#Join" target="_blank"
rel="noopener"><code>path/filepath.Join</code></a>.
</div>
<div class="admonitionblock warning">
<table>
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<tbody>
<tr>
<td class="icon"><div class="title">
Warning
</div></td>
<td class="content"><div class="paragraph">
<p>If you are joining paths in a pipeline, you almost assuredly want <a
href="#fn_path_os_ppj"><code>osPathPipeJoin</code></a> or <a
href="#fn_path_os_pspj"><code>osPathSlicePipeJoin</code></a> instead
unless you are explicitly <strong>appending</strong> a pipeline result
to a path.</p>
</div></td>
</tr>
</tbody>
</table>
</div>
<div class="listingblock">
<div class="content">
``` rouge
{{- osPathJoin "a" "b" "c" }}
{{- osPathJoin "/" "a" "b" "c" }}
{{- osPathJoin "C:\\" "a" "b" "c" }}
{{- osPathJoin "C:" "a" "b" "c" }}
```
</div>
</div>
<div class="paragraph">
renders as:
</div>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 33%" />
<col style="width: 66%" />
</colgroup>
<thead>
<tr>
<th class="tableblock halign-center valign-middle">OS</th>
<th class="tableblock halign-center valign-middle">Result</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-center valign-middle"><p>Windows</p></td>
<td class="tableblock halign-left valign-middle"><div class="content">
<div class="listingblock">
<div class="content">
<pre class="rouge highlight"><code>a\b\c
\a\b\c
\a\b\c
C:\a\b\c
C:a\b\c</code></pre>
</div>
</div>
</div></td>
</tr>
<tr>
<td class="tableblock halign-center valign-middle"><p>Others (e.g.
Linux, macOS)</p></td>
<td class="tableblock halign-left valign-middle"><div class="content">
<div class="listingblock">
<div class="content">
<pre class="rouge highlight"><code>a/b/c
/a/b/c
C:\/a/b/c
C:/a/b/c</code></pre>
</div>
</div>
</div></td>
</tr>
</tbody>
</table>
</div>
<div class="sect4">
##### <a href="#fn_path_os_ppj" class="link">4.5.2.2.
<code>osPathPipeJoin</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func osPathPipeJoin(elems ...string) (out string)
```
</div>
</div>
<div class="paragraph">
`osPathPipeJoin` operates like [`pathPipeJoin`](#fn_path_gnrc_ppj)
(except using OS-specific path separators).
</div>
<div class="paragraph">
This makes it much more suitable for use in template pipelines, as the
previous value in a pipeline is passed in as the last argument to the
next pipe function.
</div>
<div class="listingblock">
<div class="content">
``` rouge
{{- $myBase := "/a" -}}
{{- osPathPipeJoin "b" "c" "a" }}
{{- osPathPipeJoin "a" "b" "c" "/" }}
{{- $myBase | osPathPipeJoin "b" "c" }}
```
</div>
</div>
<div class="paragraph">
renders as:
</div>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 33%" />
<col style="width: 66%" />
</colgroup>
<thead>
<tr>
<th class="tableblock halign-center valign-middle">OS</th>
<th class="tableblock halign-center valign-middle">Result</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-center valign-middle"><p>Windows</p></td>
<td class="tableblock halign-left valign-middle"><div class="content">
<div class="listingblock">
<div class="content">
<pre class="rouge highlight"><code>a\b\c
\a\b\c
\a\b\c</code></pre>
</div>
</div>
</div></td>
</tr>
<tr>
<td class="tableblock halign-center valign-middle"><p>Others (e.g.
Linux, macOS)</p></td>
<td class="tableblock halign-left valign-middle"><div class="content">
<div class="listingblock">
<div class="content">
<pre class="rouge highlight"><code>a/b/c
/a/b/c
/a/b/c</code></pre>
</div>
</div>
</div></td>
</tr>
</tbody>
</table>
</div>
<div class="sect4">
##### <a href="#fn_path_ossep" class="link">4.5.2.3.
<code>osPathSep</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func osPathSep() (out string)
```
</div>
</div>
<div class="paragraph">
`osPathSep` returns the
<a href="https://pkg.go.dev/os#PathSeparator" target="_blank"
rel="noopener"><code>os.PathSeparator</code></a> for this OS.
</div>
<div class="listingblock">
<div class="content">
``` rouge
{{- osPathSep }}
```
</div>
</div>
<div class="paragraph">
renders as:
</div>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 33%" />
<col style="width: 66%" />
</colgroup>
<thead>
<tr>
<th class="tableblock halign-center valign-middle">OS</th>
<th class="tableblock halign-center valign-middle">Result</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-center valign-middle"><p>Windows</p></td>
<td class="tableblock halign-left valign-middle"><div class="content">
<div class="listingblock">
<div class="content">
<pre class="rouge highlight"><code>\</code></pre>
</div>
</div>
</div></td>
</tr>
<tr>
<td class="tableblock halign-center valign-middle"><p>Others (e.g.
Linux, macOS)</p></td>
<td class="tableblock halign-left valign-middle"><div class="content">
<div class="listingblock">
<div class="content">
<pre class="rouge highlight"><code>/</code></pre>
</div>
</div>
</div></td>
</tr>
</tbody>
</table>
</div>
<div class="sect4">
##### <a href="#fn_path_os_psj" class="link">4.5.2.4.
<code>osPathSliceJoin</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func osPathSliceJoin(sl []string) (out string)
```
</div>
</div>
<div class="paragraph">
`osPathSliceJoin` operates like [`pathSliceJoin`](#fn_path_gnrc_psj) but
with OS-specific path separators.
</div>
<div class="admonitionblock tip">
<table>
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<tbody>
<tr>
<td class="icon"><div class="title">
Tip
</div></td>
<td class="content"><div class="paragraph">
<p>The <code>splitList</code> function shown below is from the <a
href="https://masterminds.github.io/sprig/string_slice.html"
target="_blank" rel="noopener"><code>sprig</code> string slice
functions</a>.</p>
</div></td>
</tr>
</tbody>
</table>
</div>
<div class="listingblock">
<div class="content">
``` rouge
{{- $myList := "a,b,c" | splitList "," -}}
{{- $myList | osPathSliceJoin }}
{{- ("a,b,c" | splitList ",") | osPathSliceJoin }}
{{- ("/,a,b,c" | splitList ",") | osPathSliceJoin }}
```
</div>
</div>
<div class="paragraph">
renders as:
</div>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 33%" />
<col style="width: 66%" />
</colgroup>
<thead>
<tr>
<th class="tableblock halign-center valign-middle">OS</th>
<th class="tableblock halign-center valign-middle">Result</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-center valign-middle"><p>Windows</p></td>
<td class="tableblock halign-left valign-middle"><div class="content">
<div class="listingblock">
<div class="content">
<pre class="rouge highlight"><code>a\b\c
a\b\c
\a\b\c</code></pre>
</div>
</div>
</div></td>
</tr>
<tr>
<td class="tableblock halign-center valign-middle"><p>Others (e.g.
Linux, macOS)</p></td>
<td class="tableblock halign-left valign-middle"><div class="content">
<div class="listingblock">
<div class="content">
<pre class="rouge highlight"><code>a/b/c
a/b/c
/a/b/c</code></pre>
</div>
</div>
</div></td>
</tr>
</tbody>
</table>
</div>
<div class="sect4">
##### <a href="#fn_path_os_pspj" class="link">4.5.2.5.
<code>osPathSlicePipeJoin</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func osPathSlicePipeJoin(sl []string, root string) (out string)
```
</div>
</div>
<div class="paragraph">
`osPathSlicePipeJoin` operates like
[`pathSlicePipeJoin`](#fn_path_gnrc_pspj) but with OS-specific
separators.
</div>
<div class="admonitionblock tip">
<table>
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<tbody>
<tr>
<td class="icon"><div class="title">
Tip
</div></td>
<td class="content"><div class="paragraph">
<p>The <code>splitList</code> function shown below is from the <a
href="https://masterminds.github.io/sprig/string_slice.html"
target="_blank" rel="noopener"><code>sprig</code> string slice
functions</a>.</p>
</div></td>
</tr>
</tbody>
</table>
</div>
<div class="listingblock">
<div class="content">
``` rouge
{{- $myBase := "/a" -}}
{{- $myList := "b,c,d" | splitList "." -}}
{{- osPathSlicePipeJoin $myList $myBase }}
{{- $myBase | osPathSlicePipeJoin $myList }}
```
</div>
</div>
<div class="paragraph">
renders as:
</div>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 33%" />
<col style="width: 66%" />
</colgroup>
<thead>
<tr>
<th class="tableblock halign-center valign-middle">OS</th>
<th class="tableblock halign-center valign-middle">Result</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-center valign-middle"><p>Windows</p></td>
<td class="tableblock halign-left valign-middle"><div class="content">
<div class="listingblock">
<div class="content">
<pre class="rouge highlight"><code>\a\b\c\d
\a\b\c\d</code></pre>
</div>
</div>
</div></td>
</tr>
<tr>
<td class="tableblock halign-center valign-middle"><p>Others (e.g.
Linux, macOS)</p></td>
<td class="tableblock halign-left valign-middle"><div class="content">
<div class="listingblock">
<div class="content">
<pre class="rouge highlight"><code>/a/b/c/d
/a/b/c/d</code></pre>
</div>
</div>
</div></td>
</tr>
</tbody>
</table>
</div>
<div class="sect4">
##### <a href="#fn_path_os_psubj" class="link">4.5.2.6.
<code>osPathSubJoin</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func osPathSubJoin(root string, elems ...string) (out string)
```
</div>
</div>
<div class="paragraph">
`osPathSubJoin` operates like [`pathSubJoin`](#fn_path_gnrc_psubj) but
with OS-specific separators.
</div>
<div class="paragraph">
The pipeline-friendly equivalent of this is
[`osPathPipeJoin`](#fn_path_os_ppj).
</div>
<div class="listingblock">
<div class="content">
``` rouge
{{- osPathSubJoin "/a/b" "c" }}
{{- osPathSubJoin "/" "a" "b" "c" }}
{{- "c" | osPathSubJoin "/" "a" "b" }}
```
</div>
</div>
<div class="paragraph">
renders as:
</div>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 33%" />
<col style="width: 66%" />
</colgroup>
<thead>
<tr>
<th class="tableblock halign-center valign-middle">OS</th>
<th class="tableblock halign-center valign-middle">Result</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-center valign-middle"><p>Windows</p></td>
<td class="tableblock halign-left valign-middle"><div class="content">
<div class="listingblock">
<div class="content">
<pre class="rouge highlight"><code>\a\b\c
\a\b\c
\a\b\c</code></pre>
</div>
</div>
</div></td>
</tr>
<tr>
<td class="tableblock halign-center valign-middle"><p>Others (e.g.
Linux, macOS)</p></td>
<td class="tableblock halign-left valign-middle"><div class="content">
<div class="listingblock">
<div class="content">
<pre class="rouge highlight"><code>/a/b/c
/a/b/c
/a/b/c</code></pre>
</div>
</div>
</div></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="sect2">
### <a href="#fn_ps" class="link">4.6. PSUtil</a>
<div class="paragraph">
These are functions from
<a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4</code></a> packages.
</div>
<div class="sect3">
#### <a href="#fn_ps_cpu" class="link">4.6.1. CPU/Processor</a>
<div class="sect4">
##### <a href="#fn_ps_cpu_cnts" class="link">4.6.1.1.
<code>psCpuCnts</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psCpuCnts(logical bool) (numCpu int, err error)
```
</div>
</div>
<div class="paragraph">
`psCpuCnts` directly calls
<a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/cpu#Counts"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/cpu.Counts</code></a>.
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_cpu_info" class="link">4.6.1.2.
<code>psCpuInfo</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psCpuInfo() (cpuInfo [](github.com/shirou/gopsutil/v4/cpu).Info, err error)
```
</div>
</div>
<div class="paragraph">
`psCpuInfo` directly calls
<a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/cpu#Info"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/cpu.Info</code></a>.
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_cpu_pct" class="link">4.6.1.3. <code>psCpuPct</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psCpuPct(interval time.Duration, percpu bool) (pcts []float64, err error)
```
</div>
</div>
<div class="paragraph">
`psCpuPct` directly calls
<a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/cpu#Percent"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/cpu.Percent</code></a>.
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_cpu_tms" class="link">4.6.1.4.
<code>psCpuTimes</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psCpuTimes(percpu bool) (cpuTimes []TimesStat, err error)
```
</div>
</div>
<div class="paragraph">
`psCpuTimes` directly calls
<a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/cpu#Times"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/cpu.Times</code></a>.
</div>
</div>
</div>
<div class="sect3">
#### <a href="#fn_ps_dsk" class="link">4.6.2. Disk</a>
<div class="sect4">
##### <a href="#fn_ps_dsk_iocnts" class="link">4.6.2.1.
<code>psDiskIoCnts</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psDiskIoCnts(names ...string) (stats map[string]IOCountersStat, err error)
```
</div>
</div>
<div class="paragraph">
`psDiskIoCnts` directly calls <a
href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/disk#IOCounters"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/disk.IOCounters</code></a>.
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_dsk_lbl" class="link">4.6.2.2.
<code>psDiskLabel</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psDiskLabel(name string) (label string, err error)
```
</div>
</div>
<div class="paragraph">
`psDiskLabel` directly calls
<a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/disk#Label"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/disk.Label</code></a>.
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_dsk_parts" class="link">4.6.2.3.
<code>psDiskParts</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psDiskParts(all bool) (parts [](github.com/shirou/gopsutil/v4/disk).PartitionStat, err error)
```
</div>
</div>
<div class="paragraph">
`psDiskParts` directly calls <a
href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/disk#Partitions"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/disk.Partitions</code></a>.
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_dsk_srl" class="link">4.6.2.4.
<code>psDiskSerial</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psDiskSerial(name string) (serial string, err error)
```
</div>
</div>
<div class="paragraph">
`psDiskSerial` directly calls <a
href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/disk#SerialNumber"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/disk.SerialNumber</code></a>.
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_dsk_usg" class="link">4.6.2.5.
<code>psDiskUsage</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psDiskUsage(path string) (usage *(github.com/shirou/gopsutil/v4/disk).UsageStat, err error)
```
</div>
</div>
<div class="paragraph">
`psDiskUsage` directly calls
<a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/disk#Usage"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/disk.Usage</code></a>.
</div>
</div>
</div>
<div class="sect3">
#### <a href="#fn_ps_hst" class="link">4.6.3. Host</a>
<div class="sect4">
##### <a href="#fn_ps_hst_boot" class="link">4.6.3.1.
<code>psHostBoot</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psHostBoot() (bootEpoch uint64, err error)
```
</div>
</div>
<div class="paragraph">
`psHostBoot` directly calls
<a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/host#BootTime"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/host.BootTime</code></a>.
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_hst_id" class="link">4.6.3.2. <code>psHostId</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psHostId() (hostId string, err error)
```
</div>
</div>
<div class="paragraph">
`psHostId` directly calls
<a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/host#HostID"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/host.HostID</code></a>.
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_hst_info" class="link">4.6.3.3.
<code>psHostInfo</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psHostInfo() (info *(github.com/shirou/gopsutil/v4/host).InfoStat, err error)
```
</div>
</div>
<div class="paragraph">
`psHostInfo` directly calls
<a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/host#Info"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/host.Info</code></a>.
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_hst_krnarch" class="link">4.6.3.4.
<code>psHostKernArch</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psHostKernArch() (arch string, err error)
```
</div>
</div>
<div class="paragraph">
`psHostKernArch` directly calls <a
href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/host#KernelArch"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/host.KernelArch</code></a>.
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_hst_krnver" class="link">4.6.3.5.
<code>psHostKernVer</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psHostKernVer() (ver string, err error)
```
</div>
</div>
<div class="paragraph">
`psHostKernVer` directly calls <a
href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/host#KernelVersion"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/host.KernelVersion</code></a>.
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_hst_plat" class="link">4.6.3.6.
<code>psHostPlatInfo</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psHostPlatInfo() (platInfo [3]string, err error)
```
</div>
</div>
<div class="paragraph">
`psHostPlatInfo` wraps <a
href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/host#PlatformInformation"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/host.PlatformInformation</code></a>.
</div>
<div class="paragraph">
It is necessary to wrap because the function normally returns
`(string, string, string, error)` but a template function may only
return either a single value (of any type) or a single value of any type
and an error, so the three `string` returns are consolidated into an
ordered `[3]string`.
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_hst_uptm" class="link">4.6.3.7.
<code>psHostPlatUptime</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psHostPlatUptime() (uptimeSecs uint64, err error)
```
</div>
</div>
<div class="paragraph">
`psHostPlatUptime` directly calls
<a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/host#Uptime"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/host.Uptime</code></a>.
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_hst_usrs" class="link">4.6.3.8.
<code>psHostUsers</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psHostUsers() (users [](github.com/shirou/gopsutil/v4/host).UserStat, err error)
```
</div>
</div>
<div class="paragraph">
`psHostUsers` directly calls
<a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/host#Users"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/host.Users</code></a>.
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_hst_virt" class="link">4.6.3.9.
<code>psHostPlatVirt</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psHostVirt() (virtInfo [2]string, err error)
```
</div>
</div>
<div class="paragraph">
`psHostPlatVirt` wraps <a
href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/host#Virtualization"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/host.Virtualization</code></a>.
</div>
<div class="paragraph">
It is necessary to wrap because the function normally returns
`(string, string, error)` but a template function may only return either
a single value (of any type) or a single value of any type and an error,
so the two `string` returns are consolidated into an ordered
`[2]string`.
</div>
</div>
</div>
<div class="sect3">
#### <a href="#fn_ps_ld" class="link">4.6.4. Load</a>
<div class="sect4">
##### <a href="#fn_ps_ld_avg" class="link">4.6.4.1. <code>psLoadAvg</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psLoadAvg() (avg *(github.com/shirou/gopsutil/v4/load).AvgStat, err error)
```
</div>
</div>
<div class="paragraph">
`psLoadAvg` directly calls
<a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/load#Avg"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/load.Avg</code></a>.
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_ld_misc" class="link">4.6.4.2.
<code>psLoadMisc</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psLoadMisc() (misc *(github.com/shirou/gopsutil/v4/load).MiscStat, err error)
```
</div>
</div>
<div class="paragraph">
`psLoadMisc` directly calls
<a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/load#Misc"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/load.Misc</code></a>.
</div>
</div>
</div>
<div class="sect3">
#### <a href="#fn_ps_mem" class="link">4.6.5. Memory</a>
<div class="sect4">
##### <a href="#fn_ps_mem_exvmem" class="link">4.6.5.1.
<code>psMemExVMem</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psMemExVMem() (exVMem *(github.com/shirou/gopsutil/v4/mem).ExVirtualMemory, err error)
```
</div>
</div>
<div class="admonitionblock warning">
<table>
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<tbody>
<tr>
<td class="icon"><div class="title">
Warning
</div></td>
<td class="content"><div class="paragraph">
<p>This function is available on Windows and Linux platforms
<strong>only</strong>.</p>
</div></td>
</tr>
</tbody>
</table>
</div>
<div class="admonitionblock warning">
<table>
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<tbody>
<tr>
<td class="icon"><div class="title">
Warning
</div></td>
<td class="content"><div class="paragraph">
<p>This function returns very different types depending on platform.</p>
</div>
<div class="ulist">
<ul>
<li><p>Linux: <a
href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/mem?GOOS=linux#ExVirtualMemory"
target="_blank"
rel="noopener"><code>mem.ExVirtualMemory</code></a></p></li>
<li><p>Windows: <a
href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/mem?GOOS=windows#ExVirtualMemory"
target="_blank"
rel="noopener"><code>mem.ExVirtualMemory</code></a></p></li>
</ul>
</div></td>
</tr>
</tbody>
</table>
</div>
<div class="paragraph">
This function wraps
`github.com/shirou/gopsutil/v4/mem.NewExLinux`
.[`VirtualMemory`](https://pkg.go.dev/github.com/shirou/gopsutil/v4/mem?GOOS=linux#ExLinux.VirtualMemory)
on Linux and
`github.com/shirou/gopsutil/v4/mem.NewExWindows`
.[`VirtualMemory`](https://pkg.go.dev/github.com/shirou/gopsutil/v4/mem?GOOS=windows#ExWindows.VirtualMemory)
on Windows.
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_mem_swap" class="link">4.6.5.2.
<code>psMemSwap</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psMemSwap() (swap *(github.com/shirou/gopsutil/v4/mem).SwapMemoryStat, err error)
```
</div>
</div>
<div class="paragraph">
`psMemSwap` directly calls <a
href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/mem#SwapMemory"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/mem.SwapMemory</code></a>.
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_mem_swapdevs" class="link">4.6.5.3.
<code>psMemSwapDevs</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psMemSwapDevs() (swapDevs []*(github.com/shirou/gopsutil/v4/mem).SwapDevice, err error)
```
</div>
</div>
<div class="paragraph">
`psMemSwapDevs` directly calls <a
href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/mem#SwapDevices"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/mem.SwapDevices</code></a>.
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_mem_vmem" class="link">4.6.5.4.
<code>psMemVMem</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psMemVMem() (vmem *(github.com/shirou/gopsutil/v4/mem).VirtualMemoryStat, err error)
```
</div>
</div>
<div class="paragraph">
`psMemVMem` directly calls <a
href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/mem#VirtualMemory"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/mem.VirtualMemory</code></a>.
</div>
</div>
</div>
<div class="sect3">
#### <a href="#fn_ps_net" class="link">4.6.6. Network</a>
<div class="sect4">
##### <a href="#fn_ps_net_conns" class="link">4.6.6.1.
<code>psNetConns</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psNetConns(kind string) (conns [](github.com/shirou/gopsutil/v4/net).ConnectionStat, err error)
```
</div>
</div>
<div class="paragraph">
`psNetConns` directly calls <a
href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/net#Connections"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/net.Connections</code></a>.
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_net_connsmax" class="link">4.6.6.2.
<code>psNetConnsMax</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psNetConnsMax(kind string, maxConn int) (conns [](github.com/shirou/gopsutil/v4/net).ConnectionStat, err error)
```
</div>
</div>
<div class="paragraph">
`psNetConnsMax` directly calls <a
href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/net#ConnectionsMax"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/net.ConnectionsMax</code></a>.
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_net_connspid" class="link">4.6.6.3.
<code>psNetConnsPid</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psNetConnsPid(kind string, pid int32) (conns [](github.com/shirou/gopsutil/v4/net).ConnectionStat, err error)
```
</div>
</div>
<div class="paragraph">
`psNetConnsPid` directly calls <a
href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/net#ConnectionsPid"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/net.ConnectionsPid</code></a>.
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_net_connspidmax" class="link">4.6.6.4.
<code>psNetConnsPidMax</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psNetConnsPidMax(kind string, pid int32, maxConn int) (conns [](github.com/shirou/gopsutil/v4/net).ConnectionStat, err error)
```
</div>
</div>
<div class="paragraph">
`psNetConnsPidMax` directly calls <a
href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/net#ConnectionsPidMax"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/net.ConnectionsPidMax</code></a>.
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_net_ct" class="link">4.6.6.5.
<code>psNetCTStats</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psNetCTStats(percCpu bool) (ctStats [](github.com/shirou/gopsutil/v4/net).ConntrackStat, err error)
```
</div>
</div>
<div class="paragraph">
`psNetCTStats` directly calls <a
href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/net#ConntrackStats"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/net.ConntrackStats</code></a>.
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_net_ctlist" class="link">4.6.6.6.
<code>psNetCTStatList</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psNetCTStatList() (ctStats *(github.com/shirou/gopsutil/v4/net).ConntrackStatList, err error)
```
</div>
</div>
<div class="paragraph">
`psNetCTStatList` directly calls <a
href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/net#ConntrackStatList"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/net.ConntrackStatList</code></a>.
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_net_fltcnt" class="link">4.6.6.7.
<code>psNetFilterCnts</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psNetFilterCnts() (filterCnts [](github.com/shirou/gopsutil/v4/net).FilterStat, err error)
```
</div>
</div>
<div class="paragraph">
`psNetFilterCnts` directly calls <a
href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/net#FilterCounters"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/net.FilterCounters</code></a>.
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_net_iocnts" class="link">4.6.6.8.
<code>psNetIoCnts</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psNetIoCnts(perNIC bool) (ioCnts [](github.com/shirou/gopsutil/v4/net).IOCountersStat, err error)
```
</div>
</div>
<div class="paragraph">
`psNetIoCnts` directly calls <a
href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/net#IOCounters"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/net.IOCounters</code></a>.
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_net_iocntsfl" class="link">4.6.6.9.
<code>psNetIoCntsFile</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psNetIoCntsFile(perNIC bool, filepath string) (ioCnts [](github.com/shirou/gopsutil/v4/net).IOCountersStat, err error)
```
</div>
</div>
<div class="paragraph">
`psNetIoCntsFile` directly calls <a
href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/net#IOCountersByFile"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/net.IOCountersByFile</code></a>.
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_net_ifaces" class="link">4.6.6.10.
<code>psNetIfaces</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psNetIfaces() (ioCnts [](github.com/shirou/gopsutil/v4/net).InterfaceStatList, err error)
```
</div>
</div>
<div class="paragraph">
`psNetIfaces` directly calls <a
href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/net#Interfaces"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/net.Interfaces</code></a>.
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_net_pids" class="link">4.6.6.11.
<code>psNetPids</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psNetPids() (pids []int32, err error)
```
</div>
</div>
<div class="paragraph">
`psNetPids` directly calls
<a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/net#Pids"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/net.Pids</code></a>.
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_net_protocnts" class="link">4.6.6.12.
<code>psNetProtoCnt</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psNetProtoCnt(protos []string) (protoCnts [](github.com/shirou/gopsutil/v4/net).ProtoCountersStat, err error)
```
</div>
</div>
<div class="admonitionblock warning">
<table>
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<tbody>
<tr>
<td class="icon"><div class="title">
Warning
</div></td>
<td class="content"><div class="paragraph">
<p>This only works properly on Linux currently per upstream.</p>
</div></td>
</tr>
</tbody>
</table>
</div>
<div class="paragraph">
`psNetProtoCnt` directly calls <a
href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/net#ProtoCounters"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/net.ProtoCounters</code></a>.
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_net_rev" class="link">4.6.6.13.
<code>psNetRev</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psNetRev(b []byte) (out []byte)
```
</div>
</div>
<div class="admonitionblock warning">
<table>
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<tbody>
<tr>
<td class="icon"><div class="title">
Warning
</div></td>
<td class="content"><div class="paragraph">
<p>This function only exists on Linux.</p>
</div></td>
</tr>
</tbody>
</table>
</div>
<div class="paragraph">
`psNetRev` directly calls <a
href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/net?GOOS=linux#Reverse"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/net.Reverse</code></a>.
</div>
</div>
</div>
<div class="sect3">
#### <a href="#fn_ps_proc" class="link">4.6.7. Processes</a>
<div class="sect4">
##### <a href="#fn_ps_procs_procs" class="link">4.6.7.1.
<code>psProcs</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psProcs(pid int32) (procs []*(github.com/shirou/gopsutil/v4/process).Process, err error)
```
</div>
</div>
<div class="paragraph">
`psProcs` directly calls <a
href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/process#Processes"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/proc.Processes</code></a>.
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_proc_new" class="link">4.6.7.2.
<code>psProcNew</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psProcNew(pid int32) (proc *(github.com/shirou/gopsutil/v4/process).Process, err error)
```
</div>
</div>
<div class="paragraph">
`psProcNew` directly calls <a
href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/process#NewProcess"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/proc.NewProcess</code></a>.
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_proc_pids" class="link">4.6.7.3.
<code>psProcPids</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psProcPids() (pids []int32, err error)
```
</div>
</div>
<div class="paragraph">
`psProcPids` directly calls
<a href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/process#Pids"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/proc.Pids</code></a>.
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_proc_pidxst" class="link">4.6.7.4.
<code>psProcPidExists</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psProcPidExists(pid int32) (exists bool, err error)
```
</div>
</div>
<div class="paragraph">
`psProcPidExists` directly calls <a
href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/process#PidExists"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/proc.PidExists</code></a>.
</div>
</div>
</div>
<div class="sect3">
#### <a href="#fn_ps_sns" class="link">4.6.8. Sensors/Thermals</a>
<div class="sect4">
##### <a href="#fn_ps_sns_extemp" class="link">4.6.8.1.
<code>psSensorExTemp</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psSensorExTemp() (temps [](github.com/shirou/gopsutil/v4/sensors).ExTemperature, err error)
```
</div>
</div>
<div class="admonitionblock warning">
<table>
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<tbody>
<tr>
<td class="icon"><div class="title">
Warning
</div></td>
<td class="content"><div class="paragraph">
<p>This function only exists on Linux.</p>
</div></td>
</tr>
</tbody>
</table>
</div>
<div class="paragraph">
`psSensorExTemp` wraps
`github.com/shirou/gopsutil/v4/sensors.NewExLinux`
.[`github.com/shirou/gopsutil/v4/sensors.TemperatureWithContext`](https://pkg.go.dev/github.com/shirou/gopsutil/v4/sensors?GOOS=linux#TemperatureWithContext).
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_sns_temps" class="link">4.6.8.2.
<code>psSensorTemps</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psSensorTemps() (temps [](github.com/shirou/gopsutil/v4/sensors).TemperatureStat, err error)
```
</div>
</div>
<div class="paragraph">
`psSensorTemps` directly calls <a
href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/sensors#SensorsTemperatures"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/sensors.SensorsTemperatures</code></a>.
</div>
</div>
</div>
<div class="sect3">
#### <a href="#fn_ps_winsvc" class="link">4.6.9. Windows Services</a>
<div class="admonitionblock warning">
<table>
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<tbody>
<tr>
<td class="icon"><div class="title">
Warning
</div></td>
<td class="content"><div class="paragraph">
<p>All of these functions are only available on Windows.</p>
</div></td>
</tr>
</tbody>
</table>
</div>
<div class="sect4">
##### <a href="#fn_ps_winsvc_list" class="link">4.6.9.1.
<code>psWinsvcList</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psWinsvcList() (svcs [](github.com/shirou/gopsutil/v4/winservices).Service, err error)
```
</div>
</div>
<div class="admonitionblock warning">
<table>
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<tbody>
<tr>
<td class="icon"><div class="title">
Warning
</div></td>
<td class="content"><div class="paragraph">
<p>This function is only available on Windows.</p>
</div></td>
</tr>
</tbody>
</table>
</div>
<div class="paragraph">
`psWinsvcList` directly calls <a
href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/winservices?GOOS=windows#ListServices"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/winservices.ListServices</code></a>.
</div>
</div>
<div class="sect4">
##### <a href="#fn_ps_winsvc_new" class="link">4.6.9.2.
<code>psWinsvcNew</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func psWinsvcNew(svcName string) (svc *(github.com/shirou/gopsutil/v4/winservices).Service, err error)
```
</div>
</div>
<div class="admonitionblock warning">
<table>
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<tbody>
<tr>
<td class="icon"><div class="title">
Warning
</div></td>
<td class="content"><div class="paragraph">
<p>This function is only available on Windows.</p>
</div></td>
</tr>
</tbody>
</table>
</div>
<div class="paragraph">
`psWinsvcNew` directly calls <a
href="https://pkg.go.dev/github.com/shirou/gopsutil/v4/winservices?GOOS=windows#NewService"
target="_blank"
rel="noopener"><code>github.com/shirou/gopsutil/v4/winservices.NewService</code></a>.
</div>
</div>
</div>
</div>
<div class="sect2">
### <a href="#fn_str" class="link">4.7. Strings</a>
<div class="sect3">
#### <a href="#fn_str_extindent" class="link">4.7.1.
<code>extIndent</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func extIndent(
levels int,
skipFirst, skipEmpty, skipWhitespace bool,
indentString, input string,
) (out string)
```
</div>
</div>
<div class="paragraph">
`extIndent` allows for a MUCH more flexible indenter than the `sprig`
`indent` function.
</div>
<div class="paragraph">
It works with both Windows (`\r\n`) and POSIX (`\n`) linebreaks.
</div>
<div class="admonitionblock tip">
<table>
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<tbody>
<tr>
<td class="icon"><div class="title">
Tip
</div></td>
<td class="content"><div class="paragraph">
<p>If <code>&lt;indentString&gt;</code> is set to <code>\n</code> and
<code>&lt;levels&gt;</code> is always set to <code>1</code>, this
function can even be used to doubelspace text!</p>
</div></td>
</tr>
</tbody>
</table>
</div>
<div class="paragraph">
It has quite a few arguments, however:
</div>
<div class="listingblock">
<div class="content">
``` rouge
{{ extIndent <levels> <skipFirst> <skipEmpty> <skipWhitespace> <indentString> <input> }}
```
</div>
</div>
<div class="paragraph">
Where:
</div>
<div class="ulist">
- `<levels>`: The level of indentation for the text. If less than or
equal to `0`, `extIndent` just returns `<input>` as-is and NO-OPs
otherwise.
- `<skipFirst>`: If true, skip indenting the first line. This is
particularly handy if you like to visually align your function calls
in your templates.
- `<skipEmpty>`: If true, do not add an indent to **empty** lines (where
an "empty line" means "only has a linebreak").
- `<skipWhitespace>`: If true, do not add an indent to lines that
**only** consist of whitespace (spaces, tabs, etc.) and a linebreak.
- `<indentString>`: The string to use as the "indent character". This
can be any string, such as `" "`, `"\t"`, `"."`, `"|"`, `"=="` etc.
- `<input>`: The text to be indented. Because it is the last argument,
`extIndent` works with pipelined text as well.
</div>
</div>
</div>
<div class="sect2">
### <a href="#fn_tm" class="link">4.8. Time/Dates/Timestamps</a>
<div class="admonitionblock note">
<table>
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<tbody>
<tr>
<td class="icon"><div class="title">
Note
</div></td>
<td class="content"><div class="paragraph">
<p>Some of these functions duplicate Sprig functionality, but are
included here for predictable API.</p>
</div>
<div class="paragraph">
<p>Care has been taken to name these functions differently from the
Sprig functions where possible and sensible.</p>
</div></td>
</tr>
</tbody>
</table>
</div>
<div class="sect3">
#### <a href="#fn_tm_date" class="link">4.8.1. <code>tmDate</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func tmDate(year int, month time.Month, day, hour, min, sec, nsec int, loc *time.Location) (date time.Time)
```
</div>
</div>
<div class="paragraph">
`tmDate` directly calls
<a href="https://pkg.go.dev/time#Date" target="_blank"
rel="noopener"><code>time.Date</code></a>.
</div>
</div>
<div class="sect3">
#### <a href="#fn_tm_fltmic" class="link">4.8.2.
<code>tmFloatMicro</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func tmFloatMicro(t time.Time) (f64 float64)
```
</div>
</div>
<div class="paragraph">
`tmFloatMicro` directly calls
<a href="https://pkg.go.dev/r00t2.io/goutils/timex#F64Microseconds"
target="_blank"
rel="noopener"><code>(r00t2.io/goutils/timex).F64Microseconds</code></a>.
</div>
</div>
<div class="sect3">
#### <a href="#fn_tm_fltmill" class="link">4.8.3.
<code>tmFloatMilli</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func tmFloatMilli(t time.Time) (f64 float64)
```
</div>
</div>
<div class="paragraph">
`tmFloatMilli` directly calls
<a href="https://pkg.go.dev/r00t2.io/goutils/timex#F64Milliseconds"
target="_blank"
rel="noopener"><code>(r00t2.io/goutils/timex).F64Milliseconds</code></a>.
</div>
</div>
<div class="sect3">
#### <a href="#fn_tm_fltnano" class="link">4.8.4.
<code>tmFloatNano</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func tmFloatNano(t time.Time) (f64 float64)
```
</div>
</div>
<div class="paragraph">
`tmFloatNano` directly calls
<a href="https://pkg.go.dev/r00t2.io/goutils/timex#F64Nanoseconds"
target="_blank"
rel="noopener"><code>(r00t2.io/goutils/timex).F64Nanoseconds</code></a>.
</div>
</div>
<div class="sect3">
#### <a href="#fn_tm_flt" class="link">4.8.5. <code>tmFloat</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func tmFloat(t time.Time) (f64 float64)
```
</div>
</div>
<div class="paragraph">
`tmFloat` directly calls
<a href="https://pkg.go.dev/r00t2.io/goutils/timex#F64Seconds"
target="_blank"
rel="noopener"><code>(r00t2.io/goutils/timex).F64Seconds</code></a>.
</div>
</div>
<div class="sect3">
#### <a href="#fn_tm_fmt" class="link">4.8.6. <code>tmFmt</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func tmFmt(fstr string, t time.Time) (out string)
```
</div>
</div>
<div class="paragraph">
`tmFormat` provides a more pipeline-friendly alternative to calling e.g.
</div>
<div class="listingblock">
<div class="content">
``` rouge
{{- $t := tmNow -}}
{{ $t.Format "<some time format string>" }}
```
</div>
</div>
</div>
<div class="sect3">
#### <a href="#fn_tm_now" class="link">4.8.7. <code>tmNow</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func tmNow() (now time.Time)
```
</div>
</div>
<div class="paragraph">
`tmNow` directly calls
<a href="https://pkg.go.dev/time#Now" target="_blank"
rel="noopener"><code>time.Now</code></a>.
</div>
</div>
<div class="sect3">
#### <a href="#fn_tm_pdur8n" class="link">4.8.8.
<code>tmParseDur8n</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func tmParseDur8n(s string) (d time.Duration, err error)
```
</div>
</div>
<div class="paragraph">
`tmParseDur8n` directly calls
<a href="https://pkg.go.dev/time#ParseDuration" target="_blank"
rel="noopener"><code>time.ParseDuration</code></a>.
</div>
</div>
<div class="sect3">
#### <a href="#fn_tm_pmnth" class="link">4.8.9. <code>tmParseMonth</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func tmParseMonth(v any) (mon time.Month, err error)
```
</div>
</div>
<div class="paragraph">
`tmParseMonth` attempts to first try [`tmParseMonthInt`](#fn_tm_pmnthi)
and then tries [`tmParseMonthStr`](#fn_tm_pmnths) if `v` is not
"numeric".
</div>
</div>
<div class="sect3">
#### <a href="#fn_tm_pmnthi" class="link">4.8.10.
<code>tmParseMonthInt</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func tmParseMonthInt(n any) (mon time.Month, err error)
```
</div>
</div>
<div class="paragraph">
`tmParseMonthInt` parses a number representation of month `n` to a
<a href="https://pkg.go.dev/time#Month" target="_blank"
rel="noopener"><code>time.Month</code></a>. `n` may be any numeric type
or a string representation of a number (or a custom type derived from
those).
</div>
<div class="paragraph">
A negative integer (or float, etc.) will be converted to a positive one
(e.g. `-6` → `6` → `time.June`).
</div>
<div class="paragraph">
Floats are rounded to the nearest integer.
</div>
<div class="paragraph">
The integer should map directly to the
<a href="https://pkg.go.dev/time#example-Month" target="_blank"
rel="noopener"><code>time.Month</code> constants</a> in the `time`
module:
</div>
<div class="ulist">
- `1`: `time.January`
- `2`: `time.February`
- `3`: `time.March`
- `4`: `time.April`
- `5`: `time.May`
- `6`: `time.June`
- `7`: `time.July`
- `8`: `time.August`
- `9`: `time.September`
- `10`: `time.October`
- `11`: `time.November`
- `12`: `time.December`
</div>
<div class="paragraph">
If `n` resolves to `0`, `mon` will be the current month (as determined
by <a href="https://pkg.go.dev/time#Now" target="_blank"
rel="noopener"><code>time.Now</code></a>).
</div>
<div class="paragraph">
If `n` resolves to \> `12`, `err` will be `sprigx.ErrBadMonth` (though
be sure to use <a href="https://pkg.go.dev/errors#Is" target="_blank"
rel="noopener"><code>errors.Is</code></a>; 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).
</div>
</div>
<div class="sect3">
#### <a href="#fn_tm_pmnths" class="link">4.8.11.
<code>tmParseMonthStr</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func tmParseMonthStr(s string) (mon time.Month, err error)
```
</div>
</div>
<div class="paragraph">
`tmParseMonthStr` parses a string representation `s` of a month to a
<a href="https://pkg.go.dev/time#Month" target="_blank"
rel="noopener"><code>time.Month</code></a>.
</div>
<div class="paragraph">
It normalizes `s` to lowercase and only uses the first 3 characters (the
minimum length needed to determine month name uniqueness - "June" vs.
"July", "March" vs. "May").
</div>
<div class="paragraph">
An empty (or whitespace-only) string will use the current month (as
determined by <a href="https://pkg.go.dev/time#Now" target="_blank"
rel="noopener"><code>time.Now</code></a>).\`
</div>
</div>
<div class="sect3">
#### <a href="#fn_tm_ptm" class="link">4.8.12. <code>tmParseTime</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func tmParseTime(layout, value string) (t time.Time, err error)
```
</div>
</div>
<div class="paragraph">
`tmParseTime` directly calls
<a href="https://pkg.go.dev/time#Parse" target="_blank"
rel="noopener"><code>time.Parse</code></a>.
</div>
<div class="paragraph">
Be sure that `layout` is a properly parseable
<a href="https://pkg.go.dev/time#Layout" target="_blank"
rel="noopener">layout format</a>.
</div>
</div>
</div>
<div class="sect2">
### <a href="#fn_sys" class="link">4.9. System/Platform/Architecture</a>
<div class="sect3">
#### <a href="#fn_sys_arch" class="link">4.9.1. <code>sysArch</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func sysArch() (out string)
```
</div>
</div>
<div class="paragraph">
Returns the <a href="https://pkg.go.dev/runtime#GOARCH" target="_blank"
rel="noopener"><code>runtime.GOARCH</code></a> constant.
</div>
</div>
<div class="sect3">
#### <a href="#fn_sys_numcpu" class="link">4.9.2. <code>sysNumCpu</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func sysNumCpu() (cnt int)
```
</div>
</div>
<div class="paragraph">
`sysNumCpu` directly calls
<a href="https://pkg.go.dev/runtime#NumCPU" target="_blank"
rel="noopener"><code>runtime.NumCPU</code></a>.
</div>
</div>
<div class="sect3">
#### <a href="#fn_sys_os" class="link">4.9.3. <code>sysOsName</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func sysOsNm() (out string)
```
</div>
</div>
<div class="paragraph">
Returns the <a href="https://pkg.go.dev/runtime#GOOS" target="_blank"
rel="noopener"><code>runtime.GOOS</code></a> constant.
</div>
</div>
<div class="sect3">
#### <a href="#fn_sys_rntm" class="link">4.9.4. <code>sysRuntime</code></a>
<div class="listingblock">
<div class="title">
Function Signature
</div>
<div class="content">
``` rouge
func sysRuntime() (out map[string]string)
```
</div>
</div>
<div class="paragraph">
This function returns a `map[string]string` of various information from
the <a href="https://pkg.go.dev/runtime" target="_blank"
rel="noopener"><code>runtime</code> stdlib library</a>.
</div>
<div class="paragraph">
Specifically, the following are returned.
</div>
<div class="admonitionblock tip">
<table>
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<tbody>
<tr>
<td class="icon"><div class="title">
Tip
</div></td>
<td class="content"><div class="paragraph">
<p>The value type is a direct link to the <code>runtime</code>
documentation providing more detail about the associated value.</p>
</div>
<div class="paragraph">
<p>Because all values are mapped as strings, they can be converted back
to their native type via e.g. the <a
href="https://masterminds.github.io/sprig/conversion.html"
target="_blank" rel="noopener">Sprig conversion functions</a> if
necessary.</p>
</div></td>
</tr>
</tbody>
</table>
</div>
| Key | Value Type |
|----|----|
| `compiler` | <a href="https://pkg.go.dev/runtime#Compiler" target="_blank"
rel="noopener">string</a> |
| `arch` | <a href="https://pkg.go.dev/runtime#GOARCH" target="_blank"
rel="noopener">string</a> |
| `os` | <a href="https://pkg.go.dev/runtime#GOOS" target="_blank"
rel="noopener">string</a> |
| `maxprocs` | <a href="https://pkg.go.dev/runtime#GOMAXPROCS" target="_blank"
rel="noopener">int</a> <sup>\[<a href="#_footnotedef_1" id="_footnoteref_1" class="footnote"
title="View footnote.">1</a>\]</sup> |
| `cpu_cnt` | <a href="https://pkg.go.dev/runtime#NumCPU" target="_blank"
rel="noopener">int</a> |
| `num_cgo` | <a href="https://pkg.go.dev/runtime#NumCgoCall" target="_blank"
rel="noopener">int</a> |
| `num_go` | <a href="https://pkg.go.dev/runtime#NumGoroutine" target="_blank"
rel="noopener">int</a> |
| `go_ver` | <a href="https://pkg.go.dev/runtime#Version" target="_blank"
rel="noopener">string</a> |
Table 1. `sysRuntime` Values
<div class="paragraph">
As a convenience, some of these values also have their own dedicated
functions as well:
</div>
<div class="ulist">
- [`sysArch`](#fn_sys_arch)
- [`sysNumCpu`](#fn_sys_numcpu)
- [`sysOsName`](#fn_sys_os)
</div>
</div>
</div>
</div>
</div>
</div>
<div id="footnotes">
------------------------------------------------------------------------
<div id="_footnotedef_1" class="footnote">
[1](#_footnoteref_1). For safety concerns, `sprigx` does not allow
**setting** `GOMAXPROCS`, this value only contains the **current**
`GOMAXPROCS` value.
</div>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2026-01-30 06:31:37 -0500
</div>
</div>