Skip to content

Commit

Permalink
update yi
Browse files Browse the repository at this point in the history
  • Loading branch information
godcong committed Nov 6, 2019
1 parent aa0ee54 commit 02003a7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
26 changes: 12 additions & 14 deletions guaxiang.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,19 @@ type GuaXiang struct {

var gx map[string]*GuaXiang

func GetGuaXiang() map[string]*GuaXiang {
return getGuaXiang()
}
func getGuaXiang() map[string]*GuaXiang {
if gx == nil {
gx = make(map[string]*GuaXiang)
data, err := libDecompressStatik()
if err != nil {
panic(err)
}
err = json.Unmarshal(data, &gx)
if err != nil {
panic(err)
}
func init() {
gx = make(map[string]*GuaXiang)
data, err := libDecompressStatik()
if err != nil {
panic(err)
}
err = json.Unmarshal(data, &gx)
if err != nil {
panic(err)
}
}

func GetGuaXiang() map[string]*GuaXiang {
return gx
}

Expand Down
4 changes: 2 additions & 2 deletions guaxiang_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1482,8 +1482,8 @@ func TestSetGuaXiang(t *testing.T) {
}

func TestGetGuaXiang(t *testing.T) {
if len(getGuaXiang()) != 64 {
t.Log("not enough", getGuaXiang())
if len(GetGuaXiang()) != 64 {
t.Log("not enough", GetGuaXiang())
}

}

0 comments on commit 02003a7

Please sign in to comment.