go语言报错:
xxx declared and not used
代码类似:
1 2 3 4 5 6 7 8 9 10 11 12 | 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
代码类似:
1 2 3 4 5 6 7 8 9 10 11 12 | 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”}