exercism / go-test-runner

GNU Affero General Public License v3.0
15 stars 17 forks source link

Replace `print` commands without final newline #6

Open tehsphinx opened 4 years ago

tehsphinx commented 4 years ago

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:

mhutter commented 3 years ago

Upstream issue: golang/go#26325

junedev commented 3 years ago

@mhutter Thanks a lot for finding the correct issues in the Go repo!

jmrunkle commented 2 years ago

@junedev - is this something we still want to do?

junedev commented 2 years ago

Imo not a very high priority but in general yes. There is no solution of the uptream issue in sight so the problem described here still exists.

junedev commented 2 years ago

I am pondering some edge cases of the replacement logic mentioned above.

TheFranconianCoder commented 1 year ago

This seems to be fixed with go 1.20 for --short --json. Still a problem with -v --json.