Project Structure
├── cmd
│ └── main.go
├── go.mod
└── internal
└── testt
main.go
// main.go
package main
import (
"fmt"
"example.com/myproject/internal/testt"
)
// Define a struct abhi
type abhi struct {
value string
}
// Implement Can_do method for abhi
func (a *abhi) Can_do() {
fmt.Println("abhi_can_do")
}
// Implement small method for abhi
func (a *abhi) small() {
fmt.Println("small")
}
func main() {
var a abhi
var b testt.Nandu_test
b = &a
b.Can_do()
b.Can_do()
}
testt.go
package testt
type Nandu_test interface {
Can_do()
small()
}
查找图像时出错
错误:不能使用&a(*abhi类型的值)作为赋值中的testt.Nandu_test值:*abhi没有实现testt.Nandu_test(未导出的方法小)compilerInvalidIfaceAssign
我想知道为什么会发生这种情况,软件包是如何工作的