Skip to content

Commit

Permalink
feat(singleton_lazy): 移除不必要代码
Browse files Browse the repository at this point in the history
close #14
  • Loading branch information
mohuishou committed Jan 30, 2024
1 parent c42a47d commit 2dd6023
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions 01_singleton/singleton_lazy.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ var (

// GetLazyInstance 懒汉式
func GetLazyInstance() *Singleton {
if lazySingleton != nil {
return lazySingleton
}

// once 内的方法只会执行一次,所以不需要再次判断
once.Do(func() {
lazySingleton = &Singleton{a: "test"}
Expand Down

0 comments on commit 2dd6023

Please sign in to comment.