File tree 3 files changed +7
-10
lines changed
3 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ import (
10
10
"os"
11
11
"path/filepath"
12
12
"strings"
13
- "sync"
14
13
)
15
14
16
15
// CmdName - base.CmdName
@@ -19,11 +18,8 @@ const (
19
18
URL = "https://github.com/openset/leetcode/tree/master"
20
19
)
21
20
22
- // base var
23
- var (
24
- Commands []* Command
25
- Mutex sync.Mutex
26
- )
21
+ // Commands - base.Commands
22
+ var Commands []* Command
27
23
28
24
// Command - base.Command
29
25
type Command struct {
Original file line number Diff line number Diff line change @@ -9,12 +9,13 @@ import (
9
9
"regexp"
10
10
"sort"
11
11
"strconv"
12
+ "sync"
12
13
13
- "github.com/openset/leetcode/internal/base"
14
14
"github.com/openset/leetcode/internal/client"
15
15
)
16
16
17
17
var (
18
+ mu sync.Mutex
18
19
initTags []TagType
19
20
tagsFile = filepath .Join ("tag" , "tags.json" )
20
21
)
@@ -135,10 +136,10 @@ func GetTopicTag(slug string) (tt TopicTagType) {
135
136
}
136
137
137
138
func saveTags (tags []TagType ) {
138
- base .Mutex .Lock ()
139
+ mu .Lock ()
140
+ defer mu .Unlock ()
139
141
tags = append (GetTags (), tags ... )
140
142
filePutContents (tagsFile , jsonEncode (tagsUnique (tags )))
141
- base .Mutex .Unlock ()
142
143
}
143
144
144
145
func tagsUnique (tags []TagType ) []TagType {
Original file line number Diff line number Diff line change 8
8
"github.com/openset/leetcode/internal/base"
9
9
)
10
10
11
- const version = "1.6.0 "
11
+ const version = "1.6.1 "
12
12
13
13
// CmdVersion - version.CmdVersion
14
14
var CmdVersion = & base.Command {
You can’t perform that action at this time.
0 commit comments