我想从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
}
答案 0 :(得分:4)
initializeBucket()
和seedAccounts()
是BoltClient
类型的方法,快速修复:
func (bc *BoltClient) Seed() {
bc.initializeBucket()
bc.seedAccounts()
}