Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: misleading error message with mixed named and unnamed return values #26493

Closed
ghost opened this issue Jul 20, 2018 · 1 comment
Closed

Comments

@ghost
Copy link

ghost commented Jul 20, 2018

What version of Go are you using (go version)?

go1.10.3 linux/amd64

Does this issue reproduce with the latest release?

Yes.

What did you do?

I tried to go build the following file:

package a

func f() (int, int, named int) {
	return 0, 0, 0
}

What did you expect to see?

Something like

./a.go:3:27: mixed named and unnamed return values

What did you see instead?

./a.go:3:27: duplicate argument int
@ghost ghost changed the title cmd/go: misleading warning with mixed named and unnamed return values cmd/go: misleading error message with mixed named and unnamed return values Jul 20, 2018
@bcmills
Copy link
Contributor

bcmills commented Jul 20, 2018

The error message is correct. You're declaring three named integer return values, with the names int, int, and named respectively.
https://play.golang.org/p/I6m0NMX5f_M

@bcmills bcmills closed this as completed Jul 20, 2018
@golang golang locked and limited conversation to collaborators Jul 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants