1
0
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:
Leon Klingele 2017-01-07 19:14:31 +01:00
parent 089bb2acbd
commit 3e26b30ae8
No known key found for this signature in database
GPG Key ID: 83AEC0FEBAA5D483

View File

@ -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
}