digitalocean/go-openvswitch

Return value of VSwitch.ListBridges()

hwchiu opened this issue · 3 comments

Hi all.

If there're not any OpenvSwitch in the system but the length of the return value of VSwitch.ListBridges() is 1 not zero.

I think that is caused by the strings.Split and you can find it below.

func (v *VSwitchService) ListBridges() ([]string, error) {
output, err := v.exec("list-br")
if err != nil {
return nil, err
}
bridges := strings.Split(strings.TrimSpace(string(output)), "\n")
return bridges, err
}

Do we need to fix it by return a empty string array if the output of list-br is empty string?

Thanks.

Yep, that makes sense to me!

Same here. Fix this #54 to return the empty array. :)

Has fixed, thanks