Skip to content

Instantly share code, notes, and snippets.

@nf
Created October 12, 2010 23:52
Show Gist options
  • Save nf/623139 to your computer and use it in GitHub Desktop.
Save nf/623139 to your computer and use it in GitHub Desktop.
package main
import "fmt"
var singleton = NewSingleton()
type Singleton struct {
S string
}
func NewSingleton() *Singleton {
return &Singleton{"foo"}
}
func main() {
fmt.Println(singleton.S)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment