Skip to content

False positive for functions in map #82

Closed

Description

@mholt
var cmdMap = map[string]func() error{
	"cmd1": func() error { // OK
		return errors.New("foo")
	},
	"cmd2": func() error { // false positive
		return nil
	},
}

In this code, I think it's pretty clear cmd2 needs to have an error return because the signature of the map value mandates it, but it gets flagged as "result 0 (error) is always nil".

Activity

  1. mholt commented on Jan 1, 2025

    @mholt
    Author

    Possibly a duplicate of #40

    This really needs to be fixed. Putting nolint everywhere is defeating the purpose, so I will probably be uninstalling the linter.

  2. mholt commented on Aug 13, 2026

    @mholt
    Author

    Awesome thank you!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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