Article Directory
1. Import multiple dependency packages
import(
“fmt”
“os”
)
2. Relative path guide package
Import other models in the current file directory
Import "./model"
3. Absolute path guide package
Load the $GOPATH/src/shorturl/model module
Import "shorturl/model"
4. Point operation
Directly import all the functions and variables under the model and then fmt.Print() can be abbreviated as
Print()
import(
. "fmt"
)
5. Alias operation
Give the model an alias and then follow fmt.Print() which can be abbreviated as f1.Print()
import(
f1 "fmt"
)
6. _Null introduction operation
Do not introduce any variables and functions in the package,
just for execution, the init function in the model
7. Import custom packages
New mymodel
cd mymodel
go mod init kiki/mymodel
Create a new module folder dir1
in main
import (
"kiki/mymodel/dir1"
)
dir1. Uppercase method name