replace & with new()

This commit is contained in:
2026-07-13 13:33:40 +02:00
parent f4fe1aa875
commit 6cae5ddef9
16 changed files with 49 additions and 51 deletions

View File

@@ -27,7 +27,7 @@ func (b *ByteSize) String() string {
}
func Bytes(size int64) *ByteSize {
return &ByteSize{size: uint64(size)}
return new(ByteSize{size: uint64(size)})
}
func ByteString(size int64) string {

View File

@@ -43,7 +43,7 @@ type Table struct {
}
func NewTable(conf *cfg.Config, columns, rows int) *Table {
table := Table{Mode: conf.Output, maxwidth: cfg.GetTermWidth()}
table := new(Table{Mode: conf.Output, maxwidth: cfg.GetTermWidth()})
table.Headers = make([]string, columns)
table.RawHeaders = make([]string, columns)
@@ -51,14 +51,14 @@ func NewTable(conf *cfg.Config, columns, rows int) *Table {
table.lenHeaders = make([]int, columns)
table.alignInts = conf.AlignInts
return &table
return table
}
func NewTableEmpty(conf *cfg.Config) *Table {
table := Table{Mode: conf.Output, maxwidth: cfg.GetTermWidth()}
table := new(Table{Mode: conf.Output, maxwidth: cfg.GetTermWidth()})
table.alignInts = conf.AlignInts
return &table
return table
}
func (table *Table) WithHeaders(headers ...string) *Table {