我是 Go 語言的新手,正在嘗試學習它,所以請原諒任何明顯的問題,但需要一些幫助。問題:我試圖僅過濾 DetectEntitiesOutput 中 Comprehend 返回的組織實體。我的進口如下 "errors" "fmt" "strings" "github.com/aws/aws-lambda-go/lambda" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/comprehend" func Filter(vs []Entity, f func(Entity) bool) []Entity { vsf := make([]Entity, 0) for _, v := range vs { if f(v) { vsf = append(vsf, v) } } return vsf } func isOrg(vs Entity) bool { return strings.EqualFold(Entity.Type, "ORGANIZATION") }```But i am getting following error ./main.go:52:18: undefined: Entity./main.go:53:16: undefined: Entity./main.go:62:15: undefined: Entity./main.go:63:27: undefined: EntityCan someone help?
1 回答

慕萊塢森
TA貢獻1810條經(jīng)驗 獲得超4個贊
編譯器找不到Entity
結(jié)構(gòu)體的定義。確保它存在于同一個包中,或者如果它來自不同的包,則將其替換Entity
為packageName.Entity
.
- 1 回答
- 0 關(guān)注
- 168 瀏覽
添加回答
舉報
0/150
提交
取消