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

False positive when using variable in a slice #22

Closed
ajpetersons opened this issue Nov 2, 2021 · 0 comments
Closed

False positive when using variable in a slice #22

ajpetersons opened this issue Nov 2, 2021 · 0 comments

Comments

@ajpetersons
Copy link

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

esimonov pushed a commit that referenced this issue Nov 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants