You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
256 B
18 lines
256 B
2 years ago
|
package singleton
|
||
|
|
||
|
type Singleton struct{}
|
||
|
|
||
|
var singleton *Singleton
|
||
|
|
||
|
func init() {
|
||
|
singleton = &Singleton{}
|
||
|
}
|
||
|
|
||
|
// GetHungerInstance
|
||
|
//
|
||
|
// @Description: 饿汉式获取实例
|
||
|
// @return *Singleton
|
||
|
func GetHungerInstance() *Singleton {
|
||
|
return singleton
|
||
|
}
|