1
0
mirror of https://github.com/go-task/task.git synced 2025-06-27 00:51:05 +02:00

cache dymanic variables

This commit is contained in:
Andrey Nering
2017-07-05 21:03:59 -03:00
parent 222b5cb587
commit ad1a440576
2 changed files with 15 additions and 0 deletions

View File

@ -26,6 +26,12 @@ func (e *Executor) handleDynamicVariableContent(value string) (string, error) {
return value, nil
}
e.muDynamicCache.Lock()
defer e.muDynamicCache.Unlock()
if result, ok := e.dynamicCache[value]; ok {
return result, nil
}
buff := bytes.NewBuffer(nil)
opts := &execext.RunCommandOptions{
@ -46,6 +52,7 @@ func (e *Executor) handleDynamicVariableContent(value string) (string, error) {
result = strings.TrimSpace(result)
e.verbosePrintfln(`task: dynamic variable: "%s", result: "%s"`, value, result)
e.dynamicCache[value] = result
return result, nil
}