1
0
mirror of https://github.com/go-task/task.git synced 2025-11-29 22:48:03 +02:00

Watch: Clear vars cache between runs

Closes #365
This commit is contained in:
Andrey Nering
2021-01-05 11:19:34 -03:00
parent d830178ef8
commit 2d52485d7b
5 changed files with 21 additions and 1 deletions

View File

@@ -9,4 +9,5 @@ import (
type Compiler interface {
GetVariables(t *taskfile.Task, call taskfile.Call) (*taskfile.Vars, error)
HandleDynamicVar(v taskfile.Var) (string, error)
ResetCache()
}

View File

@@ -109,3 +109,11 @@ func (c *CompilerV2) HandleDynamicVar(v taskfile.Var) (string, error) {
return result, nil
}
// ResetCache clear the dymanic variables cache
func (c *CompilerV2) ResetCache() {
c.muDynamicCache.Lock()
defer c.muDynamicCache.Unlock()
c.dynamicCache = nil
}

View File

@@ -96,3 +96,11 @@ func (c *CompilerV3) HandleDynamicVar(v taskfile.Var) (string, error) {
return result, nil
}
// ResetCache clear the dymanic variables cache
func (c *CompilerV3) ResetCache() {
c.muDynamicCache.Lock()
defer c.muDynamicCache.Unlock()
c.dynamicCache = nil
}