I have this line:
fmt.Printlin("the dao:", dao);
and it logs:
the overall method looks like:
func (dao *UserAttributeDao) GetDecryptedUserAttributes(workflowID string) (*PayoutUserAttributeRecord, error) {
getItemInput := &dynamodb.GetItemInput{
TableName: aws.String(payoutUserAttributesTableName),
ConsistentRead: aws.Bool(true),
Key: map[string]*dynamodb.AttributeValue{
payoutUserAttributesPK: {S: aws.String(workflowID)},
},
}
fmt.Println("the dao:", dao)
record, err := dao.GetItem(getItemInput) // NIL POINTER REF HERE
if err != nil {
logrus.WithError(err).Errorf("error during GetItem from DynamoDB table %v for id: %v",
payoutUserAttributesTableName, workflowID)
return nil, err
}
does anyone know why calling the method would result in a nil pointer? To me it seems like the object for which the method is being called is nil, but that doesn't make that much sense to me. My main method looks like:
func main() {
log.Println("doing some printing")
var d = new(lib.UserAttributeDao)
x, err := d.GetDecryptedUserAttributes(""); // THIS RESULTS IN NIL POINTER
if err != nil {
log.Fatal(err)
}
}
....