From aaa71b1bf45d077569fb8ff3412d9fa43bcf91d0 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Thu, 14 Feb 2019 13:35:44 +0900 Subject: cmd/gobgp: fix policy printing make policy printing same with v1.x Signed-off-by: FUJITA Tomonori --- cmd/gobgp/neighbor.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'cmd') diff --git a/cmd/gobgp/neighbor.go b/cmd/gobgp/neighbor.go index 106d53be..9226e4e2 100644 --- a/cmd/gobgp/neighbor.go +++ b/cmd/gobgp/neighbor.go @@ -1042,7 +1042,6 @@ func stateChangeNeighbor(cmd string, remoteIP string, args []string) error { } func showNeighborPolicy(remoteIP, policyType string, indent int) error { - var assignment *api.PolicyAssignment var err error var dir api.PolicyDirection @@ -1064,11 +1063,13 @@ func showNeighborPolicy(remoteIP, policyType string, indent int) error { if err != nil { return err } + assignment := &api.PolicyAssignment{} r, err := stream.Recv() - if err != nil { + if err == nil { + assignment = r.Assignment + } else if err != io.EOF { return err } - assignment = r.Assignment if globalOpts.Json { j, _ := json.Marshal(assignment) -- cgit v1.2.3