File tree 1 file changed +4
-4
lines changed
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -101,9 +101,9 @@ func (t *Tools) GetLocation(command string) (string, error) {
101
101
102
102
// writeMap() writes installed map to the json file "installed.json"
103
103
func (t * Tools ) writeMap () error {
104
- t .mutex .RLock ()
104
+ t .mutex .Lock ()
105
105
b , err := json .Marshal (t .installed )
106
- t .mutex .RUnlock ()
106
+ defer t .mutex .Unlock ()
107
107
if err != nil {
108
108
return err
109
109
}
@@ -113,13 +113,13 @@ func (t *Tools) writeMap() error {
113
113
114
114
// readMap() reads the installed map from json file "installed.json"
115
115
func (t * Tools ) readMap () error {
116
+ t .mutex .Lock ()
117
+ defer t .mutex .Unlock ()
116
118
filePath := path .Join (dir (), "installed.json" )
117
119
b , err := ioutil .ReadFile (filePath )
118
120
if err != nil {
119
121
return err
120
122
}
121
- t .mutex .Lock ()
122
- defer t .mutex .Unlock ()
123
123
return json .Unmarshal (b , & t .installed )
124
124
}
125
125
You can’t perform that action at this time.
0 commit comments