1
0
mirror of https://github.com/chai2010/advanced-go-programming-book.git synced 2025-05-27 23:12:20 +00:00

Merge pull request #235 from fuwensun/pr4-4-4b

fix code
This commit is contained in:
chai2010 2018-08-07 05:40:19 +08:00 committed by GitHub
commit b5bcab6939
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -315,9 +315,9 @@ func (p *PubsubService) Publish(
func (p *PubsubService) Subscribe(
arg *String, stream PubsubService_SubscribeServer,
) error {
ch := p.Subscribe(func(v interface{}) bool {
ch := p.pub.SubscribeTopic(func(v interface{}) bool {
if key, ok := v.(string); ok {
if strings.Hasprefix(arg.GetValue()) {
if strings.HasPrefix(key,arg.GetValue()) {
return true
}
}