Skip to content

Instantly share code, notes, and snippets.

@J7mbo
Created February 22, 2019 12:04
Show Gist options
  • Select an option

  • Save J7mbo/ad87a9bd2874dca8c595bb1c909de68c to your computer and use it in GitHub Desktop.

Select an option

Save J7mbo/ad87a9bd2874dca8c595bb1c909de68c to your computer and use it in GitHub Desktop.
golang-constructors-blog-1
type MyStruct struct { }
func NewMyStruct() MyStruct {
return MyStruct{dep: ADependency{}}
}
type ADependency struct { }
myStruct := NewMyStruct() // We get back a valid struct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment