cmd/geth: remove tablewriter dependency and implement manual output formatting

This commit is contained in:
Tinu280 2025-11-19 14:57:06 +07:00
parent e0d81d1e99
commit 2ab5b9c110
5 changed files with 31 additions and 15 deletions

BIN
bin/golangci-lint Executable file

Binary file not shown.

View file

@ -760,11 +760,17 @@ func showMetaData(ctx *cli.Context) error {
data = append(data, []string{"headHeader.Root", fmt.Sprintf("%v", h.Root)})
data = append(data, []string{"headHeader.Number", fmt.Sprintf("%d (%#x)", h.Number, h.Number)})
}
table := tablewriter.NewWriter(os.Stdout)
table.SetHeader([]string{"Field", "Value"})
table.AppendBulk(data)
table.Render()
return nil
table.SetHeader([]string{"Key", "Value"})
for key, value := range stats {
table.Append([]string{key, fmt.Sprintf("%v", value)})
}
fmt.Println("Key\tValue")
for key, value := range stats {
fmt.Printf("%s\t%v\n", key, value)
}
return nil
}
func inspectAccount(db *triedb.Database, start uint64, end uint64, address common.Address, raw bool) error {

View file

@ -206,3 +206,11 @@ func (t *Table) printRow(row []string, widths []int) {
}
fmt.Fprintln(t.out)
}
package rawdb
import "io"
// TinyGo doesn't support table formatting; use minimal placeholder.
type Table struct{}
func NewTableWriter(w io.Writer) *Table { return &Table{} }

View file

@ -19,15 +19,13 @@
package rawdb
import (
"io"
import "io"
"github.com/olekukonko/tablewriter"
)
// Re-export the real tablewriter types and functions
type Table = tablewriter.Table
func newTableWriter(w io.Writer) *Table {
return tablewriter.NewWriter(w)
// Table is a placeholder struct for manual table rendering.
type Table struct {
w io.Writer
}
func NewTableWriter(w io.Writer) *Table {
return &Table{w: w}
}

4
e --short HEAD Normal file
View file

@ -0,0 +1,4 @@
docs/fix-broken-links
docs/fix-readme-typo
* event/simplify-conditional
master