File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -188,7 +188,7 @@ func (t *Tools) Install(ctx context.Context, payload *tools.ToolPayload) (*tools
188188 key := correctTool .Name + "-" + correctTool .Version
189189 // Check if it already exists
190190 if t .behaviour == "keep" && pathExists (t .folder ) {
191- location , ok := t .installed [ key ]
191+ location , ok := t .getInstalledValue ( key )
192192 if ok && pathExists (location ) {
193193 // overwrite the default tool with this one
194194 err := t .writeInstalled (path )
@@ -336,6 +336,13 @@ func (t *Tools) SetBehaviour(behaviour string) {
336336 t .behaviour = behaviour
337337}
338338
339+ func (t * Tools ) getInstalledValue (key string ) (string , bool ) {
340+ t .mutex .RLock ()
341+ defer t .mutex .RUnlock ()
342+ location , ok := t .installed [key ]
343+ return location , ok
344+ }
345+
339346func pathExists (path string ) bool {
340347 _ , err := os .Stat (path )
341348 if err == nil {
You can’t perform that action at this time.
0 commit comments