如何模拟另一个包中的函数?

Package A

func Validate(){
    db.CheckPresent() //how to mock this function which is in another package
    return nil
}

I am writing test case in Golang to test a function which calls CheckPresent() function from another package. How to mock CheckPresent() fuction?

type Checker interface {
    CheckPresent()
}

// mock
type checkerMock struct {
}

func (m checkerMock) CheckPresent() {
}

// production code
type handler struct {
    db Checker
}

func New(db Checker) *handler {
    return &handler{
        db: db,
    }
}

func (h handler) Validate() {
    h.db.CheckPresent() 
    return nil
}