10000 staticcheck: check for mistakenly returning a nil error · Issue #640 · dominikh/go-tools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
staticcheck: check for mistakenly returning a nil error #640
Open
@FiloSottile

Description

@FiloSottile

I caught this code in crypto/tls

	if sigType == 0 || err != nil {
		c.sendAlert(alertInternalError)
		return err
	}

You can see that if sigType == 0 && err == nil, we return nil, when in fact an error occurred.

This feels common enough and likely enough to be a mistake that staticcheck might raise it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    aggressiveA set of checks that is more prone to false positives but is helpful during code reviewnew-check

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0