Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
Tips and Traps¶
Golang implements the type
Tuplein the standard librarygo/types, however,Tupleis NOT a first class citizen in Golang.Multiple return parameters in Golang is implemented via
Tuplein a limited way (sinceTupleis not a first-class citizen).Tuple can only be used as multiple return parameters/values currently.
Since
Tupleis not a first-class citizen, you cannot use aTupleto receive multiple return values. Instead, you have to use define multiple variables to receive multiple return values.Nested types is NOT allowed as return parameters.
In [7]:
import "go/types"
In [8]:
types.Tuple
In [ ]: