mirror of
https://github.com/tmrts/go-patterns.git
synced 2025-02-16 12:33:16 +03:00
Singleton: Do not require sync package
This commit is contained in:
parent
089bb2acbd
commit
3e26b30ae8
@ -9,14 +9,12 @@ package singleton
|
||||
|
||||
type singleton map[string]string
|
||||
|
||||
var once sync.Once
|
||||
|
||||
var instance singleton
|
||||
|
||||
func New() singleton {
|
||||
once.Do(func() {
|
||||
if instance == nil {
|
||||
instance = make(singleton)
|
||||
})
|
||||
}
|
||||
|
||||
return instance
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user