カスタムパッケージに行く

go:mytestのsrcディレクトリにパッケージパスを作成します

mytest.goを作成します

package mytest

/*方法名首字母要大写*/
func NxyTest() {
    fmt.Println("this is my test")
}

テストデモを書く

package main


import (
    "fmt"
    "mytest"
)

func main(){
    fmt.Println("begin")
    mytest.NxyTest()
}

 

おすすめ

転載: blog.csdn.net/woailp___2005/article/details/110468201