嗨我是新手在golang.
我有两个文件,main.go这就是下package main,并在包被调用函数的一些功能的另一个文件.
我的问题是:我如何调用函数package main?
文件1:main.go(位于MyProj/main.go)
package main
import "fmt"
import "functions" // I dont have problem creating the reference here
func main(){
c:= functions.getValue() // <---- this is I want to do
}
Run Code Online (Sandbox Code Playgroud)
文件2:functions.go(位于MyProj/functions/functions.go中)
package functions
func getValue() string{
return "Hello from this another package"
}
Run Code Online (Sandbox Code Playgroud)
非常感谢你的帮助.
go ×1