From 896238910585557e798212cca6d216dd12ab04b8 Mon Sep 17 00:00:00 2001 From: sfw Date: Tue, 31 Jul 2018 18:35:53 +0800 Subject: [PATCH] fixed code --- ch4-rpc/ch4-02-pb-intro.md | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/ch4-rpc/ch4-02-pb-intro.md b/ch4-rpc/ch4-02-pb-intro.md index 29a156f..ed92ad9 100644 --- a/ch4-rpc/ch4-02-pb-intro.md +++ b/ch4-rpc/ch4-02-pb-intro.md @@ -285,18 +285,16 @@ func (p *netrpcPlugin) buildServiceSpec(svc *descriptor.ServiceDescriptorProto) ```go func (p *netrpcPlugin) genServiceCode(svc *descriptor.ServiceDescriptorProto) { - for _, svc := range file.Service { - spec := p.buildServiceSpec(svc) + spec := p.buildServiceSpec(svc) - var buf bytes.Buffer - t := template.Must(template.New("").Parse(tmplService)) - err := t.Execute(&buf, spec) - if err != nil { - log.Fatal(err) - } - - p.P(buf.String()) + var buf bytes.Buffer + t := template.Must(template.New("").Parse(tmplService)) + err := t.Execute(&buf, spec) + if err != nil { + log.Fatal(err) } + + p.P(buf.String()) } ```