You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
go version devel +5ad0a524d2 Sat Jul 28 09:06:26 2018 +0000 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
linux/amd64
What did you do?
Apply the below patch and run the test on cmd/go (the tabs are changed to spaces).
In my case this happened accidentally due to text editor settings. The program was gofmt compliant since the code itself is a string inside the go file and gofmt does not interpret it.
Even though tabs are the recommended indentation, space should not result in test failure.
The test is just verifying what the import stack error looks like. Seems like this issue should be focused on the what the import stack error looks like as opposed to the test that verifies it. So perhaps you're saying that the import stack error should have spaces instead of tabs.
But it looks like it's standard practice to have tabs in error messages. For example, this panic uses a tab. (Highlight the empty space and compare to that of the spaces in the first line to see that it is a tab.)
mvdan
changed the title
Test code (cmd/go/go_test.go) fail with spaces instead of tab
cmd/go: test code fails if indented with spaces
Jul 30, 2018
I'm not sure what we could do here. It should be fine for a test to require specific output via a multiline literal string - why should an editor automatically modify these?
mvdan
changed the title
cmd/go: test code fails if indented with spaces
cmd/go: TestGoTestImportErrorStack fails if wanted output is indented with spaces
Jul 30, 2018
The intent of the test is now clear that it is the expected output. From the code I was of the impression it is attempting to import/compile it.
The problem was accidental that when one types, visual code (and several editors) automatically give empty spaces and not tabs. One runs gofmt to fix it. In this case obviously that does not help.
What version of Go are you using (
go version
)?go version devel +5ad0a524d2 Sat Jul 28 09:06:26 2018 +0000 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?linux/amd64
What did you do?
Apply the below patch and run the test on cmd/go (the tabs are changed to spaces).
In my case this happened accidentally due to text editor settings. The program was gofmt compliant since the code itself is a string inside the go file and gofmt does not interpret it.
go_test.patch.txt
What did you expect to see?
Success
Even though tabs are the recommended indentation, space should not result in test failure.
What did you see instead?
Failed test
The text was updated successfully, but these errors were encountered: