I’m stuck on Stage #EA6 - It seems to me like I’m outputting the right things, but I guess it must be going to stdout somehow. I’ve tried using a logger instead, I’ve tried changing between fmt.Fprintf and println, I’m not sure why my output isn’t being seen by the tester.
Here are my logs:
remote: [tester::#EA6] Running tests for Stage #EA6 (Scanning: Lexical errors)
remote: [tester::#EA6] [test-1] Running test case: 1
remote: [tester::#EA6] [test-1] Writing contents to ./test.lox:
remote: [tester::#EA6] [test-1] [test.lox] @
remote: [tester::#EA6] [test-1] $ ./your_program.sh tokenize test.lox
remote: [your_program] Logs from your program will appear here!
remote: [your_program] EOF null
remote: [your_program] [Line 1] Error: Unexpected character: @
remote: [tester::#EA6] [test-1] ? [line 1] Error: Unexpected character: @
remote: [tester::#EA6] [test-1] Skipped 2 lines that didn't start with [line N]
remote: [tester::#EA6] [test-1] Expected line #1 on stderr to be "[line 1] Error: Unexpected character: @", but didn't find line
remote: [tester::#EA6] [test-1] Test failed
And here’s a snippet of my code:
convertedContents := (string)(fileContents)
cleanRun := true
if len(convertedContents) > 0 {
for index, char := range convertedContents {
if scanned, validFile := tokens[char]; validFile {
fmt.Println(scanned)
} else {
line := strings.Count(convertedContents[0:index], "\n") + 1
fmt.Fprintf(os.Stderr, "[Line %d] Error: Unexpected character: %c", line, char)
cleanRun = false
}
}
fmt.Println("EOF null")