Removed fmt.Stringer artistry from all roouter and table structs

This commit is contained in:
Milos Gajdos
2019-07-09 16:17:18 +01:00
parent c5fb409760
commit 23cb811f60
5 changed files with 7 additions and 120 deletions

View File

@@ -1,11 +1,7 @@
package table
import (
"fmt"
"hash/fnv"
"strings"
"github.com/olekukonko/tablewriter"
)
var (
@@ -44,25 +40,5 @@ func (r *Route) Hash() uint64 {
// String returns human readable route
func (r Route) String() string {
// this will help us build routing table string
sb := &strings.Builder{}
// create nice table printing structure
table := tablewriter.NewWriter(sb)
table.SetHeader([]string{"Service", "Address", "Gateway", "Network", "Link", "Metric"})
strRoute := []string{
r.Service,
r.Address,
r.Gateway,
r.Network,
r.Link,
fmt.Sprintf("%d", r.Metric),
}
table.Append(strRoute)
// render table into sb
table.Render()
return sb.String()
return "route"
}