Go报错:non-declaration statement outside function body

./slice.go:5:1: syntax error: non-declaration statement outside function body

意思就是在func外,每个语句都必须是golang的关键字开始,否则就报这个错,写在函数体内就好。

这应该也是一种可以的解决方案

syntax error: non-declaration statement outside function body_小马过河-CSDN博客

猜你喜欢

转载自blog.csdn.net/wangchao701123/article/details/123312233
今日推荐