Skip to content
This repository was archived by the owner on Jul 31, 2022. It is now read-only.
This repository was archived by the owner on Jul 31, 2022. It is now read-only.

False positive when using variable in a slice #22

@ajpetersons

Description

@ajpetersons

The following (oversimplified) example produces a false positive:

type output struct {
	err error
	str string
}

func getValue(ch chan output) ([]string, error) {
	out := <-ch
	if out.err != nil {
		return []string{}, out.err
	}

	return []string{out.str}, nil
}

In our code there are more actions happening between the two returns, but the function signature is required to be like this to satisfy interface requirements

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