Skip to content

Commit

Permalink
fixed deadlock bug
Browse files Browse the repository at this point in the history
  • Loading branch information
瑞涛 杨 committed Dec 24, 2021
1 parent 132b6d7 commit e1f7fda
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion example/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ module example

go 1.17

require github.com/Scorpio69t/goi18n v0.0.3
require github.com/Scorpio69t/goi18n v0.0.4

require github.com/pelletier/go-toml v1.9.4 // indirect
4 changes: 2 additions & 2 deletions example/go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github.com/Scorpio69t/goi18n v0.0.3 h1:rYvvsCy23I1HdUKp6ss9dWdjp82w/YhVMwKBuZ/l4io=
github.com/Scorpio69t/goi18n v0.0.3/go.mod h1:qW94sC8uhtmdkjiHugKL4kfSE+NB5vRSCL8COxkyEkY=
github.com/Scorpio69t/goi18n v0.0.4 h1:cGQKN4LkN7W2nZVFDLHOmkzShIVzq8mY7yYzlfBtkmc=
github.com/Scorpio69t/goi18n v0.0.4/go.mod h1:qW94sC8uhtmdkjiHugKL4kfSE+NB5vRSCL8COxkyEkY=
github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM=
github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
2 changes: 0 additions & 2 deletions goi18n.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ func (g *Goi18n) SetLanguage(lang string, desc string) bool {

// T returns the translation of key by default language.
func (g *Goi18n) T(key string) string {
g.mu.RLock()
defer g.mu.RUnlock()
if g.IsExist(g.option.Language) || g.add(&locale{lang: g.option.Language}) {
value, _ := g.localeMap[g.option.Language].Get(key)
return value
Expand Down

0 comments on commit e1f7fda

Please sign in to comment.