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
opennota opened this issue Jul 20, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@opennota
Copy link

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

@opennota opennota 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

This comment has been minimized.

Copy link
Member

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 Jul 20, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.