mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-31 22:07:25 -08:00
fix: remove map cache
This commit is contained in:
parent
0fb5951375
commit
b8e8eddd01
|
@ -9,21 +9,16 @@ import (
|
||||||
"github.com/Masterminds/sprig/v3"
|
"github.com/Masterminds/sprig/v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
var funcMapCache map[string]interface{}
|
|
||||||
|
|
||||||
func funcMap() template.FuncMap {
|
func funcMap() template.FuncMap {
|
||||||
if funcMapCache != nil {
|
funcMap := map[string]interface{}{
|
||||||
return template.FuncMap(funcMapCache)
|
|
||||||
}
|
|
||||||
funcMapCache = map[string]interface{}{
|
|
||||||
"secondsRound": secondsRound,
|
"secondsRound": secondsRound,
|
||||||
}
|
}
|
||||||
for key, fun := range sprig.TxtFuncMap() {
|
for key, fun := range sprig.TxtFuncMap() {
|
||||||
if _, ok := funcMapCache[key]; !ok {
|
if _, ok := funcMap[key]; !ok {
|
||||||
funcMapCache[key] = fun
|
funcMap[key] = fun
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return template.FuncMap(funcMapCache)
|
return template.FuncMap(funcMap)
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseSeconds(seconds interface{}) (int, error) {
|
func parseSeconds(seconds interface{}) (int, error) {
|
||||||
|
|
Loading…
Reference in a new issue