Skip to content

don't warn when removing all result parameters would add complexity to the code #24

@mvdan

Description

@mvdan

For example, say that the result of foo here is never used, as it's always called like foo() or _ = foo():

func foo() bar {
    if cond {
        return foo2()
    }
    return foo3()
}

However, following unparam's advice to remove the result parameter will make the code longer:

func foo() {
    if cond {
        foo2()
        return
    }
    foo3()
}

A couple of examples from go version devel +4a52452a2f Wed Feb 28 22:05:23 2018 +0000 linux/amd64:

regexp/syntax/parse.go:297:27: (*parser).concat - result 0 (*regexp/syntax.Regexp) is never used
regexp/syntax/parse.go:317:30: (*parser).alternate - result 0 (*regexp/syntax.Regexp) is never used

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