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/compile: not enough arguments error should be multiple lines #17650

Closed
rsc opened this issue Oct 28, 2016 · 2 comments
Closed

cmd/compile: not enough arguments error should be multiple lines #17650

rsc opened this issue Oct 28, 2016 · 2 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@rsc
Copy link
Contributor

rsc commented Oct 28, 2016

Getting errors like this:

./ipsock_test.go:223: not enough arguments in call to filterAddrList, got (func(IPAddr) bool, []IPAddr, func(IPAddr) Addr) want (func(IPAddr) bool, []IPAddr, func(IPAddr) Addr, string)

Please make them:

./ipsock_test.go:223: not enough arguments in call to filterAddrList
    have (func(IPAddr) bool, []IPAddr, func(IPAddr) Addr)
    want (func(IPAddr) bool, []IPAddr, func(IPAddr) Addr, string)

to match other similar error from the compiler. Note the use of "have" not "got", because then both prefixes are the same length (even in most variable width fonts), so that it is easier to visually diff the two.

Thanks.

@rsc rsc added this to the Go1.8 milestone Oct 28, 2016
@rsc rsc added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 28, 2016
@mdempsky
Copy link
Member

Two other nits I noticed while looking at this more closely:

fmt.Println(1, 2, (3)...)

causes us to print:

have (number, number, number)
want (...interface{})

which is misleading because it doesn't reflect that this is a ... call.

Also, given

func f() (string, string) { return "", "" }
func g(string, string, string) {}

calling g(f()), gives:

have ((string, string))
want (string, string, string)

and the extra parentheses are unnecessary.

@gopherbot
Copy link

CL https://golang.org/cl/32261 mentions this issue.

@golang golang locked and limited conversation to collaborators Oct 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants