go语言报错:
xxx declared and not used
代码类似:
var test Test
type Test struct{
Name string
}
func main(){
test := Text{name:"test"}
}
func set(t Test){
test = t
}
经过排查发现,错误原因在于main函数里使用了 :=
应该是:
test = Text{name:”test”}
go语言报错:
xxx declared and not used
代码类似:
var test Test
type Test struct{
Name string
}
func main(){
test := Text{name:"test"}
}
func set(t Test){
test = t
}
经过排查发现,错误原因在于main函数里使用了 :=
应该是:
test = Text{name:”test”}