我有下面的函数接受布尔指针。我想知道是否有任何符号允许我在结构字面量中将is
字段的值设置为true
;基本上没有定义一个新的标识符(i.e. var x := true ; handler{is: &x})
如何在结构体字符中将bool指针设置为true?
package main
import "fmt"
func main() {
fmt.Println("Hello, playground")
check(handler{is: new(bool) })
}
type handler struct{
is *bool
}
func check(is handler){}
相关:http:// stackoverflow。com/questions/30716354/how-do-a-literal-int64-in-go – icza 2015-06-10 09:17:11