1. 忽略返回值
function Test() (string, error) {
return "hello", nil
}
if _, err := Test(); err != nil {
//錯誤處理
}
2. 用在變量,特別是接口斷言
type Person interface {
Say()
}type Student struct {
}var _ Person = Student{}
3. 忽略導入的包,只執行包內的init方法
import _ routers