Skip to content

Refactored table rendering codes to support updated tablewriter v1.0.7 #20893

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
.cache
_obj
_test
vendor

#Don't ignore arch linux .SRCINFO
!.SRCINFO
Expand Down
10 changes: 5 additions & 5 deletions cmd/minikube/cmd/config/addons_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@
sort.Strings(addonNames)

table := tablewriter.NewWriter(os.Stdout)
table.SetAutoFormatHeaders(true)
table.SetBorders(tablewriter.Border{Left: true, Top: true, Right: true, Bottom: true})
table.SetCenterSeparator("|")
table.SetAutoFormatHeaders(1)

Check failure on line 99 in cmd/minikube/cmd/config/addons_list.go

View workflow job for this annotation

GitHub Actions / lint

table.SetAutoFormatHeaders undefined (type *tablewriter.Table has no field or method SetAutoFormatHeaders) (typecheck)
table.SetBorders(true)

Check failure on line 100 in cmd/minikube/cmd/config/addons_list.go

View workflow job for this annotation

GitHub Actions / lint

table.SetBorders undefined (type *tablewriter.Table has no field or method SetBorders) (typecheck)
table.SetColumnSeparator("|")

Check failure on line 101 in cmd/minikube/cmd/config/addons_list.go

View workflow job for this annotation

GitHub Actions / lint

table.SetColumnSeparator undefined (type *tablewriter.Table has no field or method SetColumnSeparator) (typecheck)

// Create table header
var tHeader []string
Expand All @@ -110,7 +110,7 @@
if printDocs {
tHeader = append(tHeader, "Docs")
}
table.SetHeader(tHeader)
table.Header(tHeader)

// Create table data
var tData [][]string
Expand All @@ -136,7 +136,7 @@
}
tData = append(tData, temp)
}
table.AppendBulk(tData)
table.Bulk(tData)

table.Render()

Expand Down
10 changes: 5 additions & 5 deletions cmd/minikube/cmd/config/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,16 @@

var tData [][]string
table := tablewriter.NewWriter(os.Stdout)
table.SetHeader([]string{"Image Name", "Default Image", "Default Registry"})
table.SetAutoFormatHeaders(true)
table.SetBorders(tablewriter.Border{Left: true, Top: true, Right: true, Bottom: true})
table.SetCenterSeparator("|")
table.Header([]string{"Image Name", "Default Image", "Default Registry"})
table.SetAutoFormatHeaders(1)

Check failure on line 67 in cmd/minikube/cmd/config/images.go

View workflow job for this annotation

GitHub Actions / lint

table.SetAutoFormatHeaders undefined (type *tablewriter.Table has no field or method SetAutoFormatHeaders) (typecheck)
table.SetBorders(true)

Check failure on line 68 in cmd/minikube/cmd/config/images.go

View workflow job for this annotation

GitHub Actions / lint

table.SetBorders undefined (type *tablewriter.Table has no field or method SetBorders) (typecheck)
table.SetColumnSeparator("|")

Check failure on line 69 in cmd/minikube/cmd/config/images.go

View workflow job for this annotation

GitHub Actions / lint

table.SetColumnSeparator undefined (type *tablewriter.Table has no field or method SetColumnSeparator) (typecheck)

for imageName, defaultImage := range conf.Images {
tData = append(tData, []string{imageName, defaultImage, conf.Registries[imageName]})
}

table.AppendBulk(tData)
table.Bulk(tData)
table.Render()
} else {
out.Infof("{{.name}} doesn't have images.", out.V{"name": addon})
Expand Down
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ require (
github.com/mitchellh/go-ps v1.0.0
github.com/moby/hyperkit v0.0.0-20210108224842-2f061e447e14
github.com/moby/patternmatcher v0.6.0
github.com/olekukonko/tablewriter v0.0.5
github.com/olekukonko/tablewriter v1.0.7
github.com/opencontainers/go-digest v1.0.0
github.com/opencontainers/runc v1.2.6
github.com/otiai10/copy v1.14.1
Expand Down Expand Up @@ -195,6 +195,8 @@ require (
github.com/muesli/reflow v0.3.0 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/olekukonko/errors v0.0.0-20250405072817-4e6d85265da6 // indirect
github.com/olekukonko/ll v0.0.8 // indirect
github.com/opencontainers/image-spec v1.1.0 // indirect
github.com/opencontainers/runtime-spec v1.2.0 // indirect
github.com/otiai10/mint v1.6.3 // indirect
Expand Down
9 changes: 6 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1657,7 +1657,6 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
Expand Down Expand Up @@ -1767,9 +1766,13 @@ github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU=
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
github.com/olekukonko/errors v0.0.0-20250405072817-4e6d85265da6 h1:r3FaAI0NZK3hSmtTDrBVREhKULp8oUeqLT5Eyl2mSPo=
github.com/olekukonko/errors v0.0.0-20250405072817-4e6d85265da6/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y=
github.com/olekukonko/ll v0.0.8 h1:sbGZ1Fx4QxJXEqL/6IG8GEFnYojUSQ45dJVwN2FH2fc=
github.com/olekukonko/ll v0.0.8/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g=
github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
github.com/olekukonko/tablewriter v1.0.7 h1:HCC2e3MM+2g72M81ZcJU11uciw6z/p82aEnm4/ySDGw=
github.com/olekukonko/tablewriter v1.0.7/go.mod h1:H428M+HzoUXC6JU2Abj9IT9ooRmdq9CxuDmKMtrOCMs=
github.com/onsi/ginkgo v0.0.0-20151202141238-7f8ab55aaf3b/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
Expand Down
10 changes: 5 additions & 5 deletions hack/benchmark/time-to-k8s/chart.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,11 @@ func outputMarkdownTable(categories []plotter.Values, totals []float64, names []
b := new(bytes.Buffer)
t := tablewriter.NewWriter(b)
t.SetAutoWrapText(false)
t.SetHeader(headers)
t.SetAutoFormatHeaders(false)
t.SetBorders(tablewriter.Border{Left: true, Top: false, Right: true, Bottom: false})
t.SetCenterSeparator("|")
t.AppendBulk(c)
t.Header(headers)
t.SetAutoFormatHeaders(0)
t.SetBorders(true)
t.SetColumnSeparator("|")
t.Bulk(c)
t.Render()
data.TimeMarkdown = b.String()
}
Expand Down
10 changes: 5 additions & 5 deletions hack/benchmark/time-to-k8s/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ func cpuMarkdownTable(categories []plotter.Values, names []string) {
b := new(bytes.Buffer)
t := tablewriter.NewWriter(b)
t.SetAutoWrapText(false)
t.SetHeader(headers)
t.SetAutoFormatHeaders(false)
t.SetBorders(tablewriter.Border{Left: true, Top: false, Right: true, Bottom: false})
t.SetCenterSeparator("|")
t.AppendBulk(c)
t.Header(headers)
t.SetAutoFormatHeaders(0)
t.SetBorders(true)
t.SetColumnSeparator("|")
t.Bulk(c)
t.Render()
data.CPUMarkdown = b.String()
}
Expand Down
10 changes: 5 additions & 5 deletions pkg/minikube/audit/row.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@
}
b := new(bytes.Buffer)
t := tablewriter.NewWriter(b)
t.SetHeader(headers)
t.SetAutoFormatHeaders(false)
t.SetBorders(tablewriter.Border{Left: true, Top: true, Right: true, Bottom: true})
t.SetCenterSeparator("|")
t.AppendBulk(c)
t.Header(headers)
t.SetAutoFormatHeaders(0)

Check failure on line 128 in pkg/minikube/audit/row.go

View workflow job for this annotation

GitHub Actions / build_minikube

t.SetAutoFormatHeaders undefined (type *tablewriter.Table has no field or method SetAutoFormatHeaders)

Check failure on line 128 in pkg/minikube/audit/row.go

View workflow job for this annotation

GitHub Actions / build_minikube_test_binaries

t.SetAutoFormatHeaders undefined (type *tablewriter.Table has no field or method SetAutoFormatHeaders)

Check failure on line 128 in pkg/minikube/audit/row.go

View workflow job for this annotation

GitHub Actions / build_minikube

t.SetAutoFormatHeaders undefined (type *tablewriter.Table has no field or method SetAutoFormatHeaders)

Check failure on line 128 in pkg/minikube/audit/row.go

View workflow job for this annotation

GitHub Actions / unit_test

t.SetAutoFormatHeaders undefined (type *tablewriter.Table has no field or method SetAutoFormatHeaders)
t.SetBorders(true)

Check failure on line 129 in pkg/minikube/audit/row.go

View workflow job for this annotation

GitHub Actions / build_minikube

t.SetBorders undefined (type *tablewriter.Table has no field or method SetBorders)

Check failure on line 129 in pkg/minikube/audit/row.go

View workflow job for this annotation

GitHub Actions / build_minikube_test_binaries

t.SetBorders undefined (type *tablewriter.Table has no field or method SetBorders)

Check failure on line 129 in pkg/minikube/audit/row.go

View workflow job for this annotation

GitHub Actions / build_minikube

t.SetBorders undefined (type *tablewriter.Table has no field or method SetBorders)

Check failure on line 129 in pkg/minikube/audit/row.go

View workflow job for this annotation

GitHub Actions / unit_test

t.SetBorders undefined (type *tablewriter.Table has no field or method SetBorders)
t.SetColumnSeparator("|")

Check failure on line 130 in pkg/minikube/audit/row.go

View workflow job for this annotation

GitHub Actions / build_minikube

t.SetColumnSeparator undefined (type *tablewriter.Table has no field or method SetColumnSeparator)

Check failure on line 130 in pkg/minikube/audit/row.go

View workflow job for this annotation

GitHub Actions / build_minikube_test_binaries

t.SetColumnSeparator undefined (type *tablewriter.Table has no field or method SetColumnSeparator)

Check failure on line 130 in pkg/minikube/audit/row.go

View workflow job for this annotation

GitHub Actions / build_minikube

t.SetColumnSeparator undefined (type *tablewriter.Table has no field or method SetColumnSeparator)

Check failure on line 130 in pkg/minikube/audit/row.go

View workflow job for this annotation

GitHub Actions / unit_test

t.SetColumnSeparator undefined (type *tablewriter.Table has no field or method SetColumnSeparator)
t.Bulk(c)
t.Render()
return b.String()
}
12 changes: 6 additions & 6 deletions pkg/minikube/machine/cache_images.go
Original file line number Diff line number Diff line change
Expand Up @@ -845,12 +845,12 @@
// renderImagesTable renders pretty table for images list
func renderImagesTable(images [][]string) {
table := tablewriter.NewWriter(os.Stdout)
table.SetHeader([]string{"Image", "Tag", "Image ID", "Size"})
table.SetAutoFormatHeaders(false)
table.SetBorders(tablewriter.Border{Left: true, Top: true, Right: true, Bottom: true})
table.SetAlignment(tablewriter.ALIGN_LEFT)
table.SetCenterSeparator("|")
table.AppendBulk(images)
table.Header([]string{"Image", "Tag", "Image ID", "Size"})
table.SetAutoFormatHeaders(0)

Check failure on line 849 in pkg/minikube/machine/cache_images.go

View workflow job for this annotation

GitHub Actions / build_minikube

table.SetAutoFormatHeaders undefined (type *tablewriter.Table has no field or method SetAutoFormatHeaders)

Check failure on line 849 in pkg/minikube/machine/cache_images.go

View workflow job for this annotation

GitHub Actions / build_minikube_test_binaries

table.SetAutoFormatHeaders undefined (type *tablewriter.Table has no field or method SetAutoFormatHeaders)

Check failure on line 849 in pkg/minikube/machine/cache_images.go

View workflow job for this annotation

GitHub Actions / build_minikube

table.SetAutoFormatHeaders undefined (type *tablewriter.Table has no field or method SetAutoFormatHeaders)

Check failure on line 849 in pkg/minikube/machine/cache_images.go

View workflow job for this annotation

GitHub Actions / unit_test

table.SetAutoFormatHeaders undefined (type *tablewriter.Table has no field or method SetAutoFormatHeaders)
table.SetBorders(true)

Check failure on line 850 in pkg/minikube/machine/cache_images.go

View workflow job for this annotation

GitHub Actions / build_minikube

table.SetBorders undefined (type *tablewriter.Table has no field or method SetBorders)

Check failure on line 850 in pkg/minikube/machine/cache_images.go

View workflow job for this annotation

GitHub Actions / build_minikube_test_binaries

table.SetBorders undefined (type *tablewriter.Table has no field or method SetBorders)

Check failure on line 850 in pkg/minikube/machine/cache_images.go

View workflow job for this annotation

GitHub Actions / build_minikube

table.SetBorders undefined (type *tablewriter.Table has no field or method SetBorders)

Check failure on line 850 in pkg/minikube/machine/cache_images.go

View workflow job for this annotation

GitHub Actions / unit_test

table.SetBorders undefined (type *tablewriter.Table has no field or method SetBorders)
table.Alignment(0)

Check failure on line 851 in pkg/minikube/machine/cache_images.go

View workflow job for this annotation

GitHub Actions / build_minikube

table.Alignment undefined (type *tablewriter.Table has no field or method Alignment)

Check failure on line 851 in pkg/minikube/machine/cache_images.go

View workflow job for this annotation

GitHub Actions / build_minikube_test_binaries

table.Alignment undefined (type *tablewriter.Table has no field or method Alignment)

Check failure on line 851 in pkg/minikube/machine/cache_images.go

View workflow job for this annotation

GitHub Actions / build_minikube

table.Alignment undefined (type *tablewriter.Table has no field or method Alignment)

Check failure on line 851 in pkg/minikube/machine/cache_images.go

View workflow job for this annotation

GitHub Actions / unit_test

table.Alignment undefined (type *tablewriter.Table has no field or method Alignment)
table.SetColumnSeparator("|")

Check failure on line 852 in pkg/minikube/machine/cache_images.go

View workflow job for this annotation

GitHub Actions / build_minikube

table.SetColumnSeparator undefined (type *tablewriter.Table has no field or method SetColumnSeparator)

Check failure on line 852 in pkg/minikube/machine/cache_images.go

View workflow job for this annotation

GitHub Actions / build_minikube_test_binaries

table.SetColumnSeparator undefined (type *tablewriter.Table has no field or method SetColumnSeparator)

Check failure on line 852 in pkg/minikube/machine/cache_images.go

View workflow job for this annotation

GitHub Actions / build_minikube

table.SetColumnSeparator undefined (type *tablewriter.Table has no field or method SetColumnSeparator)

Check failure on line 852 in pkg/minikube/machine/cache_images.go

View workflow job for this annotation

GitHub Actions / unit_test

table.SetColumnSeparator undefined (type *tablewriter.Table has no field or method SetColumnSeparator)
table.Bulk(images)
table.Render()
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/minikube/perf/result_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (rm *resultManager) summarizeResults(binaries []*Binary) {
}
}
t := tablewriter.NewWriter(os.Stdout)
t.SetHeader([]string{"Command", binaries[0].Name(), binaries[1].Name()})
t.Header([]string{"Command", binaries[0].Name(), binaries[1].Name()})
for _, v := range table {
// Add warning sign if PR average is 5 seconds higher than average at HEAD
if len(v) >= 3 {
Expand Down
9 changes: 5 additions & 4 deletions pkg/minikube/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,11 @@ func OptionallyHTTPSFormattedURLString(bareURLString string, https bool) (string
// "Namespace", "Name" and "URL" columns to a writer
func PrintServiceList(writer io.Writer, data [][]string) {
table := tablewriter.NewWriter(writer)
table.SetHeader([]string{"Namespace", "Name", "Target Port", "URL"})
table.SetBorders(tablewriter.Border{Left: true, Top: true, Right: true, Bottom: true})
table.SetCenterSeparator("|")
table.AppendBulk(data)
table.Header([]string{"Namespace", "Name", "Target Port", "URL"})
table.SetBorders(true)
table.SetColumnSeparator("|")
table.SetColumnAlignment([]int{0, 0, 0, 0})
table.Bulk(data)
table.Render()
}

Expand Down
Loading