假设我们现在有文件目录结构如下:
└── bubble ├── dao │ └── mysql.go ├── go.mod └── main.go
其中bubble/go.mod
内容如下:
module github.com/q1mi/bubble go 1.14
bubble/dao/mysql.go
内容如下:
package dao import "fmt" func New(){ fmt.Println("mypackage.New") }
bubble/main.go
内容如下:
package main import ( "fmt" "github.com/q1mi/bubble/dao" ) func main() { dao.New() fmt.Println("main") }