I am new to Go language and trying picking it up , so pardon for any obvious issues but need some help..
Question : I am trying to filter only Organization Entities returned in by Comprehend in DetectEntitiesOutput..
My imports are following
"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: Entity
Can someone help?
The compiler cannot find definition of Entity
struct. Make sure it's present in the same package or if it's from a different package you would replace Entity
with packageName.Entity
.