0

我想从 Seed 方法调用两个方法(seedAccounts 和 initializeBucket)。有没有办法做到这一点?它一直说“未解决的参考”。

这是代码

type BoltClient struct {
    boltDB *bolt.DB
}

func (bc *BoltClient) Seed() {
    initializeBucket() //unresolved reference initializeBucket
    seedAccounts() // unresolved reference seedAccounts
}

func (bc *BoltClient) initializeBucket() {
    //Code
}

func (bc *BoltClient) seedAccounts() {
    //Code
}
4

1 回答 1

5

initializeBucket()并且seedAccounts()是 type 的方法BoltClient,快速修复:

func (bc *BoltClient) Seed() {
     bc.initializeBucket() 
     bc.seedAccounts()
}
于 2017-03-16T09:37:04.230 回答