func (c *CategoryService) CreateCategoryStream(stream pb.CategoryService_CreateCategoryStreamServer) error {
categories := &pb.CategoryList{}
for {
category, err := stream.Recv()
log.Println(category)
if err == io.EOF {
return stream.SendAndClose(categories)
}
if err != nil {
return err
}
categoryResult, err := c.CategoryDB.Create(category.Name, category.Description)
if err != nil {
return err
}
categories.Categories = append(categories.Categories, &pb.Category{
Id: categoryResult.ID,
Name: categoryResult.Name,
Description: categoryResult.Description,
})
// log.Println(categories)
}
}
I have the following func below. After add the category I pressed Ctrl+D, but it didn't raise the error io.EOF to trigger stream.SendAndClose
To reproduce
Expected behavior
Screenshots
Environment
protocversion: libprotoc 3.12.4protocplugin version (if you are using):Additional context