Skip to content

Commit d41f19a

Browse files
committed
TableContents(): make into a top-level function
Take the contents as an argument. This means that we can remove the `contents` field from `table`.
1 parent e112972 commit d41f19a

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

git-sizer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ func mainImplementation() error {
173173
}
174174
fmt.Printf("%s\n", s)
175175
} else {
176-
io.WriteString(os.Stdout, historySize.TableString(threshold, nameStyle))
176+
io.WriteString(os.Stdout, sizes.TableString(historySize.Contents(), threshold, nameStyle))
177177
}
178178

179179
return nil

sizes/output.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,22 +309,20 @@ func (n *NameStyle) Type() string {
309309
}
310310

311311
type table struct {
312-
contents tableContents
313312
threshold Threshold
314313
nameStyle NameStyle
315314
footnotes *Footnotes
316315
}
317316

318-
func (s HistorySize) TableString(threshold Threshold, nameStyle NameStyle) string {
317+
func TableString(contents tableContents, threshold Threshold, nameStyle NameStyle) string {
319318
t := table{
320-
contents: s.Contents(),
321319
threshold: threshold,
322320
nameStyle: nameStyle,
323321
footnotes: NewFootnotes(),
324322
}
325323

326324
buf := &bytes.Buffer{}
327-
t.contents.Emit(&t, buf, -1)
325+
contents.Emit(&t, buf, -1)
328326

329327
if buf.Len() == 0 {
330328
return "No problems above the current threshold were found\n"

0 commit comments

Comments
 (0)