File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,9 @@ package goat
2
2
3
3
import (
4
4
"bufio"
5
+ "log"
5
6
"io"
7
+ "os"
6
8
)
7
9
8
10
type (
@@ -156,14 +158,19 @@ func NewCanvas(in io.Reader) (c Canvas) {
156
158
// https://go.dev/ref/spec#For_statements
157
159
// But yet, counterintuitively, type of lineStr[_index_] is 'byte'.
158
160
// https://go.dev/ref/spec#String_types
159
- // XXXX Refactor to use []rune from above.
160
161
for _ , r := range lineStr {
161
162
//if r > 255 {
162
163
// fmt.Printf("linestr=\"%s\"\n", lineStr)
163
164
// fmt.Printf("r == 0x%x\n", r)
164
165
//}
165
166
if r == ' ' {
166
- panic ("TAB character found on input" )
167
+ file , isFile := in .(* os.File )
168
+ fileName := "unknown"
169
+ if isFile {
170
+ fileName = file .Name ()
171
+ }
172
+ log .Panicf ("\n \t Found TAB in %s, row %d, column %d\n " ,
173
+ fileName , height + 1 , w )
167
174
}
168
175
i := Index {w , height }
169
176
c .data [i ] = r
You can’t perform that action at this time.
0 commit comments