Created
February 4, 2017 16:13
-
-
Save danielfbm/cb0d2c9c176d40bff219920c9ad7f395 to your computer and use it in GitHub Desktop.
golang singleton design pattern
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"sync" | |
) | |
type MyStruct struct { | |
Name string | |
} | |
var singleton *MyStruct | |
func getStruct() *MyStruct { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment