Go——报错总结

前言

前端时间抽时间看完了Go基础的一些内容,后面接着学习,记录一些错误。

错误

cannot refer to unexported name fmt.println

报错信息如下:

# basic
.\main.go:6:2: cannot refer to unexported name fmt.println    //不能够引用未导出的名称fmt.println
.\main.go:6:2: undefined: fmt.println    //未定义的:fmt.println

原因:

嗯,Go中其实有规定的就是模块中要导出的函数,必须首字母大写,所以错误的原因就是fmt.Println()写成了fmt.println()

猜你喜欢

转载自www.cnblogs.com/wangyang0210/p/11202200.html