I have the function below which accepts a bool pointer. I'm wondering if there is any notation which allows me to set the value of the is
field to true
in the struct literal; basically without to define a new identifier (i.e. var x := true ; handler{is: &x} )
package main
import "fmt"
func main() {
fmt.Println("Hello, playground")
check(handler{is: new(bool) })
}
type handler struct{
is *bool
}
func check(is handler){}
var _ *bool = pointer.Bool(true)
– Robbyaws.Bool()
function specifically for this. – Undernourished