Go lets a golang function return more than one result without wrapping a struct. That is what people mean by golang return multiple values, go return multiple values, golang multiple return values, and go function return multiple values: list the types in parentheses after the parameters, then return expressions in the same order. Golang return two values is the same rule with a pair such as quotient and remainder or value plus error. This page walks syntax, ignoring values with _, the usual (T, error) pattern, and optional named results.
Examples were run with a recent Go toolchain on Linux. Snippets use fixed inputs so you can run them without command-line arguments.
Syntax: golang function return multiple values
Results appear in a second parenthesized list after parameters. Types only (no parameter names here). A return statement supplies one expression per result, in order.
package main
import "fmt"
func split(sum int) (int, int) {
x := sum * 4 / 9
return sum - x, x
}
func main() {
a, b := split(17)
fmt.Println(a, b)
}Run prints two integers that sum to 17.
Golang return two values of the same type
package main
import "fmt"
func mulDiv(n int64) (int64, int64) {
return n * 2, n / 2
}
func main() {
a, b := mulDiv(10)
fmt.Println(a, b)
}Run prints 20 and 5 on one line.
Return multiple values golang with different types
Each position in the result list can use a different type.
package main
import "fmt"
func describe(n int) (int, float64) {
return n % 2, float64(n) * 1.5
}
func main() {
mod, scaled := describe(10)
fmt.Println(mod, scaled)
}Run prints 0 and 15 for the sample input.
Ignore a result with the blank identifier
If you only need one value from a multi-value return, assign the others to _. This is the blank identifier, not a hyphen.
package main
import "fmt"
func pair(n int) (int, int) {
return n * 2, n * 4
}
func main() {
half, _ := pair(11)
fmt.Println(half)
}Run prints 22.
(T, error): multiple returns and error handling
The idiomatic pattern is to return data plus an error, with nil meaning success. Details on building and checking errors are in golang return error.
package main
import (
"errors"
"fmt"
)
func double(n int) (int, error) {
if n < 0 {
return 0, errors.New("negative not supported")
}
return n * 2, nil
}
func main() {
if v, err := double(6); err != nil {
fmt.Println(err)
} else {
fmt.Println(v)
}
if _, err := double(-1); err != nil {
fmt.Println(err)
}
}Run prints 12 then the negative-input error message.
Named return values
You may name results in the signature; they behave like variables in the function body, and a bare return sends their current values. Prefer short functions when you use naked return.
package main
import "fmt"
func minMax(x, y int) (min, max int) {
if x > y {
min, max = y, x
} else {
min, max = x, y
}
return
}
func main() {
lo, hi := minMax(2, 9)
fmt.Println(lo, hi)
}Run prints 2 and 9.
Summary
Golang return multiple values is built into the function signature: declare every result type, then return values in order. That covers golang multiple return, return multiple values golang, and go function return style APIs without extra structs. Golang return two values is the common special case, especially (T, error) for errors alongside data. Use _ to drop a result you do not need, and treat named returns as a readability tool for small functions, not a default. For variables and scope around assignments, see variable scope in Go; for functions generally, see golang function.
References
- Go by Example: multiple return values
- The Go Programming Language Specification: Function types
- Go blog: errors are values

