yet another mutex-protected variable in golang
lockVar := goprotected.New(new(int)) // import "github.com/peczenyj/go-protected" lockVar.Use(func(i *int) { *i++ }) lockVar.Use(func(i *int) { fmt.Println("got i=", *i) }) // Output: // got i= 1