The commands print, fmt.Print, fmt.Printf and maybe others currently destroy the output of go test --json as they have no final newline.
We should report that to be fixed in go test but for the time being we will replace these commands in students solutions with println / fmt.Println.
My current suggestion would be to add some sed commands to the test runner before executing the tests. This could also be done using the AST library to manipulate the AST if someone wants to dig into that.
Here the replace table I'd recommend to avoid having to remove/add imports:
print -> println
fmt.Print -> fmt.Println
fmt.Printf(...) -> fmt.Println(fmt.Sprintf(...))
The commands
print,fmt.Print,fmt.Printfand maybe others currently destroy the output ofgo test --jsonas they have no final newline.We should report that to be fixed in
go testbut for the time being we will replace these commands in students solutions withprintln/fmt.Println.My current suggestion would be to add some
sedcommands to the test runner before executing the tests. This could also be done using the AST library to manipulate the AST if someone wants to dig into that.Here the replace table I'd recommend to avoid having to remove/add imports:
print->printlnfmt.Print->fmt.Printlnfmt.Printf(...)->fmt.Println(fmt.Sprintf(...))