@@ -46,7 +46,7 @@ func NewWriter(limit int) *WordWrap {
46
46
func Bytes (b []byte , limit int ) []byte {
47
47
f := NewWriter (limit )
48
48
_ , _ = f .Write (b )
49
- f .Close ()
49
+ _ = f .Close ()
50
50
51
51
return f .Bytes ()
52
52
}
@@ -59,21 +59,21 @@ func String(s string, limit int) string {
59
59
60
60
func (w * WordWrap ) addSpace () {
61
61
w .lineLen += w .space .Len ()
62
- w .buf .Write (w .space .Bytes ())
62
+ _ , _ = w .buf .Write (w .space .Bytes ())
63
63
w .space .Reset ()
64
64
}
65
65
66
66
func (w * WordWrap ) addWord () {
67
67
if w .word .Len () > 0 {
68
68
w .addSpace ()
69
69
w .lineLen += w .word .PrintableRuneWidth ()
70
- w .buf .Write (w .word .Bytes ())
70
+ _ , _ = w .buf .Write (w .word .Bytes ())
71
71
w .word .Reset ()
72
72
}
73
73
}
74
74
75
75
func (w * WordWrap ) addNewLine () {
76
- w .buf .WriteRune ('\n' )
76
+ _ , _ = w .buf .WriteRune ('\n' )
77
77
w .lineLen = 0
78
78
w .space .Reset ()
79
79
}
@@ -101,10 +101,10 @@ func (w *WordWrap) Write(b []byte) (int, error) {
101
101
for _ , c := range s {
102
102
if c == '\x1B' {
103
103
// ANSI escape sequence
104
- w .word .WriteRune (c )
104
+ _ , _ = w .word .WriteRune (c )
105
105
w .ansi = true
106
106
} else if w .ansi {
107
- w .word .WriteRune (c )
107
+ _ , _ = w .word .WriteRune (c )
108
108
if (c >= 0x40 && c <= 0x5a ) || (c >= 0x61 && c <= 0x7a ) {
109
109
// ANSI sequence terminated
110
110
w .ansi = false
@@ -117,7 +117,7 @@ func (w *WordWrap) Write(b []byte) (int, error) {
117
117
w .lineLen = 0
118
118
} else {
119
119
// preserve whitespace
120
- w .buf .Write (w .space .Bytes ())
120
+ _ , _ = w .buf .Write (w .space .Bytes ())
121
121
}
122
122
w .space .Reset ()
123
123
}
@@ -127,15 +127,15 @@ func (w *WordWrap) Write(b []byte) (int, error) {
127
127
} else if unicode .IsSpace (c ) {
128
128
// end of current word
129
129
w .addWord ()
130
- w .space .WriteRune (c )
130
+ _ , _ = w .space .WriteRune (c )
131
131
} else if inGroup (w .Breakpoints , c ) {
132
132
// valid breakpoint
133
133
w .addSpace ()
134
134
w .addWord ()
135
- w .buf .WriteRune (c )
135
+ _ , _ = w .buf .WriteRune (c )
136
136
} else {
137
137
// any other character
138
- w .word .WriteRune (c )
138
+ _ , _ = w .word .WriteRune (c )
139
139
140
140
// add a line break if the current word would exceed the line's
141
141
// character limit
0 commit comments