Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # tag=v9.3.0
with:
version: v2.13.1
version: v2.14.0
args: --output.text.print-linter-name=true --output.text.colors=true --timeout 10m
working-directory: ${{matrix.working-directory}}
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ linters:
- nilerr
- nolintlint
- prealloc
- promlinter
- reassign
- revive
- staticcheck
- tagliatelle
Expand Down
4 changes: 2 additions & 2 deletions cmd/controller-gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ func helpForLevels(mainOut io.Writer, errOut io.Writer, whichLevel int, reg *mar
continue
}
contents := prettyhelp.MarkersDetails(fullDetail, cat.Category, cat.Markers)
if err := contents.WriteTo(errOut); err != nil {
if err := contents.Write(errOut); err != nil {
return err
}
}
Expand All @@ -259,7 +259,7 @@ func helpForLevels(mainOut io.Writer, errOut io.Writer, whichLevel int, reg *mar
continue
}
contents := prettyhelp.MarkersSummary(cat.Category, cat.Markers)
if err := contents.WriteTo(errOut); err != nil {
if err := contents.Write(errOut); err != nil {
return err
}
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/helpgen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ func usage() {
continue
}
contents := prettyhelp.MarkersDetails(true, cat.Category, cat.Markers)
if err := contents.WriteTo(os.Stderr); err != nil {
if err := contents.Write(os.Stderr); err != nil {
panic(err)
}
}
Expand All @@ -239,7 +239,7 @@ func usage() {
}
markerInfo := help.ByCategory(reg, help.SortByCategory)
contents := prettyhelp.MarkersDetails(true, "markers", markerInfo[0].Markers)
if err := contents.WriteTo(os.Stderr); err != nil {
if err := contents.Write(os.Stderr); err != nil {
panic(err)
}
os.Exit(1)
Expand Down
28 changes: 14 additions & 14 deletions pkg/genall/help/pretty/print.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ type Span interface {
// VisualLength reports the "width" as perceived by the user on the terminal
// (i.e. widest line, ignoring ANSI escape characters).
VisualLength() int
// WriteTo writes the full span contents to the given writer.
WriteTo(io.Writer) error
// Write writes the full span contents to the given writer.
Write(io.Writer) error
}

// Table is a Span that writes its data in table form, with sizing controlled
Expand Down Expand Up @@ -77,7 +77,7 @@ func (t *Table) SkipRow(contents Span) {
t.cellsByRow = append(t.cellsByRow, []Span{contents})
}

func (t *Table) WriteTo(out io.Writer) error {
func (t *Table) Write(out io.Writer) error {
if t.colSizes == nil {
t.colSizes = t.Sizing.ColumnWidths()
}
Expand All @@ -88,7 +88,7 @@ func (t *Table) WriteTo(out io.Writer) error {
colSize := t.colSizes[colInd]
diff := colSize - cell.VisualLength()

if err := cell.WriteTo(out); err != nil {
if err := cell.Write(out); err != nil {
return err
}

Expand Down Expand Up @@ -124,7 +124,7 @@ func (t *Table) VisualLength() int {
type Text string

func (t Text) VisualLength() int { return len(t) }
func (t Text) WriteTo(w io.Writer) error {
func (t Text) Write(w io.Writer) error {
_, err := w.Write([]byte(t))
return err
}
Expand All @@ -136,9 +136,9 @@ type indented struct {
}

func (i *indented) VisualLength() int { return i.Content.VisualLength() }
func (i *indented) WriteTo(w io.Writer) error {
func (i *indented) Write(w io.Writer) error {
var out bytes.Buffer
if err := i.Content.WriteTo(&out); err != nil {
if err := i.Content.Write(&out); err != nil {
return err
}

Expand Down Expand Up @@ -185,7 +185,7 @@ func (f *fromWriter) VisualLength() int {
}
return len(f.cache)
}
func (f *fromWriter) WriteTo(w io.Writer) error {
func (f *fromWriter) Write(w io.Writer) error {
if f.cache != nil {
if f.cacheError != nil {
return f.cacheError
Expand Down Expand Up @@ -219,15 +219,15 @@ type decorated struct {
}

func (d *decorated) VisualLength() int { return d.Contents.VisualLength() }
func (d *decorated) WriteTo(w io.Writer) error {
func (d *decorated) Write(w io.Writer) error {
oldOut := color.Output
color.Output = w
defer func() { color.Output = oldOut }()

d.Attributes.Set()
defer color.Unset()

return d.Contents.WriteTo(w)
return d.Contents.Write(w)
}

// SpanWriter is a span that contains multiple sub-spans.
Expand All @@ -242,9 +242,9 @@ func (m *SpanWriter) VisualLength() int {
}
return res
}
func (m *SpanWriter) WriteTo(w io.Writer) error {
func (m *SpanWriter) Write(w io.Writer) error {
for _, span := range m.contents {
if err := span.WriteTo(w); err != nil {
if err := span.Write(w); err != nil {
return err
}
}
Expand All @@ -268,12 +268,12 @@ func (l *lines) VisualLength() int {
}
return l.content.VisualLength()
}
func (l *lines) WriteTo(w io.Writer) error {
func (l *lines) Write(w io.Writer) error {
if err := writePadding(w, linesPadding, l.amountBefore); err != nil {
return err
}
if l.content != nil {
if err := l.content.WriteTo(w); err != nil {
if err := l.content.Write(w); err != nil {
return err
}
}
Expand Down
Loading