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
builtin: cannot call print with multiple return values #7640
Labels
Comments
This is not just the builtin print or println. For example, fmt.Println or fmt.Printf have the same issue. It seems that for any function signature with foo(a ...T), it will accept parameters from a function with multi-value returns, but for any other forms (e.g. foo(b string, a ...T)), it does not. The compiler will consider the return is in a single-value context. This looks like a language limitation though, not really a bug per se. On the flip side, if we were planning to fix it, I'd suggest we could support a syntax something like this: foo(a, f()...) where f()... denotes to assign multi-value returns to the []T slice. |
@2: No, it works just fine: http://play.golang.org/p/ZZgIoN2FTw |
@2 and @3: Please refer the paragraph starting with "As a special case" in the language spec (http://golang.org/ref/spec#Calls) for normal function calls. fmt.Println is working as what the spec says. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: