1
的界面我的項目的組織結構如下實現圍棋
github.com/achanda/poke
├── cmd
│ └── poke.go
├── scanner.go
├── txt_scanner.go
└── types.go
的文件如下
# cat scanner.go
package poke
type Scanner interface {
Scan() *ScanResult
}
# cat txt_scanner.go
package poke
type txtScanner struct {
txt string
}
func newTxtScanner(host string) Scanner {
return txtScanner{txt}
}
func (tcpcs txtScanner) Scan() *ScanResult {
// do stuff
return &result
}
現在,我想在我的主包調用這個(在poke.go)這樣
package main
import "github.com/achanda/poke"
func main() {
var sr poke.Scanner
sr = poke.txtScanner{txt}
sr.Scan()
}
這未能與
運行3210# command-line-arguments
./poke.go:111: cannot refer to unexported name poke.txtScanner
./poke.go:111: undefined: portscan.txtScanner
我在做什麼錯?
謝謝,那工作。錯誤信息是神祕的! –