File tree Expand file tree Collapse file tree 3 files changed +7
-10
lines changed Expand file tree Collapse file tree 3 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ import (
1010 "os"
1111 "path/filepath"
1212 "strings"
13- "sync"
1413)
1514
1615// CmdName - base.CmdName
@@ -19,11 +18,8 @@ const (
1918 URL = "https://github.com/openset/leetcode/tree/master"
2019)
2120
22- // base var
23- var (
24- Commands []* Command
25- Mutex sync.Mutex
26- )
21+ // Commands - base.Commands
22+ var Commands []* Command
2723
2824// Command - base.Command
2925type Command struct {
Original file line number Diff line number Diff line change @@ -9,12 +9,13 @@ import (
99 "regexp"
1010 "sort"
1111 "strconv"
12+ "sync"
1213
13- "github.com/openset/leetcode/internal/base"
1414 "github.com/openset/leetcode/internal/client"
1515)
1616
1717var (
18+ mu sync.Mutex
1819 initTags []TagType
1920 tagsFile = filepath .Join ("tag" , "tags.json" )
2021)
@@ -135,10 +136,10 @@ func GetTopicTag(slug string) (tt TopicTagType) {
135136}
136137
137138func saveTags (tags []TagType ) {
138- base .Mutex .Lock ()
139+ mu .Lock ()
140+ defer mu .Unlock ()
139141 tags = append (GetTags (), tags ... )
140142 filePutContents (tagsFile , jsonEncode (tagsUnique (tags )))
141- base .Mutex .Unlock ()
142143}
143144
144145func tagsUnique (tags []TagType ) []TagType {
Original file line number Diff line number Diff line change 88 "github.com/openset/leetcode/internal/base"
99)
1010
11- const version = "1.6.0 "
11+ const version = "1.6.1 "
1212
1313// CmdVersion - version.CmdVersion
1414var CmdVersion = & base.Command {
You can’t perform that action at this time.
0 commit comments