Skip to content

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

@krhubert

Description

@krhubert

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions