另一个方法中方法调用的未解析引用
Unresolved reference of a method call in another method
我想从 Seed 方法调用两个方法(seedAccounts 和 initializeBucket)。有办法吗?它一直在说 "Unresolved reference"。
这是代码
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
}
initializeBucket()
和 seedAccounts()
是类型 BoltClient
的方法,快速修复:
func (bc *BoltClient) Seed() {
bc.initializeBucket()
bc.seedAccounts()
}
我想从 Seed 方法调用两个方法(seedAccounts 和 initializeBucket)。有办法吗?它一直在说 "Unresolved reference"。
这是代码
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
}
initializeBucket()
和 seedAccounts()
是类型 BoltClient
的方法,快速修复:
func (bc *BoltClient) Seed() {
bc.initializeBucket()
bc.seedAccounts()
}