Freelancer Backend & Technical Lead; Founder of Happy Ann
Senior Freelancer & Technical Lead Working as a Golang developer since 2020. Working as a mobile developer since 2013. Focussed on architecture, testability and clean code. Open minded & product driven. Based in Rhede, available world-wide
Markdown supported · ⌘↵ to post
masood keshvari
Hi and thanks to share this blog post. I have two questions: 1) In this example, you use private variable, why you don't expose it? in other word what difference between exposed and unexposed variable in this pattern? In my opinion when we expose it, other pkg can use it with nil value and as a result the application panics. is that the reason we use unexposed variable?
2) what happening if we don't expose type Singleton? In this example Singleton type is exposed, other pkg can create instance from Singleton type directly and as a result we have many instance from Singleton type.
thanks Matthias