Skip to content

False negative with named return error #7

@maratori

Description

@maratori

The following test fails

func TestFails() (err error) {
	err2 := func() error { return nil }()
	if err2 != nil {
		return // want `return a nil value error after check error`
	}
	return
}

I think that is a false negative because almost the same test passes

func Call12() (err error) {
err = Do()
if err != nil {
return err
}
err2 := Do2()
if err2 != nil {
return // want `return a nil value error after check error`
}
return
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions