代码如下:
文件
package main import "fmt" func hello() { ("go =======") }
文件
package main func main() { hello() }
编译过程报错:
# command-line-arguments
test\:10:3: undefined: hello
Process finished with exit code 2
出现这样的原因是文件并未编译
解决方式大致有两种
第一个:通过go命令编译,go run *.go 或 (go bulid . ,. run) 第二个 :通过单元测试调用函数