Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal: [Go2] Error default handler for tests. #32361

Closed
krhubert opened this issue May 31, 2019 · 1 comment
Closed

proposal: [Go2] Error default handler for tests. #32361

krhubert opened this issue May 31, 2019 · 1 comment
Labels
error-handling Language & library change proposals that are about error handling. FrozenDueToAge Proposal
Milestone

Comments

@krhubert
Copy link

Hi,

Error handling in tests could be done with handle err as shown in this example.

But maybe go can use implicit default handler for a test so that every test function will have implicit error handler:

func TestFoo(t *testing.T) {
	handle err { t.Fatal(err) } // implicit handler.
}

Motivation is to remove repetition of the same pattern the same as with implicit default handler for functions and methods.

@gopherbot gopherbot added this to the Proposal milestone May 31, 2019
@ianlancetaylor
Copy link
Contributor

Thanks for the suggestion. I added this to the wiki at https://github.com/golang/go/wiki/Go2ErrorHandlingFeedback.

@bradfitz bradfitz added the error-handling Language & library change proposals that are about error handling. label Oct 29, 2019
@golang golang locked and limited conversation to collaborators Oct 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
error-handling Language & library change proposals that are about error handling. FrozenDueToAge Proposal
Projects
None yet
Development

No branches or pull requests

4 participants