Golang 项目中如果使用了其它模块中找不到的函数、常量等,都会提示 "cannot refer to unexported name"。
遇到这种情况,要么是拼写错误了,要么是首字母大小写写错了。
Golang 文件内,首字母大写的函数、常量等 可以被其它模块访问,首字母小写的只能在当前文件中可以使用。
Golang 项目中如果使用了其它模块中找不到的函数、常量等,都会提示 "cannot refer to unexported name"。
遇到这种情况,要么是拼写错误了,要么是首字母大小写写错了。
Golang 文件内,首字母大写的函数、常量等 可以被其它模块访问,首字母小写的只能在当前文件中可以使用。