Closed
Description
I looked around and didn't find any tickets about it, but what about a little bit of sugar for a optional auto return values as soon as there are assigned and none of them is nil using the following syntax?
// returns err if not nil
func example() error {
dat, !err := ioutil.ReadFile("/tmp/dat")
...
}
// returns (x, y) if none of them is nil
func split() (int, int) {
!(x, y) := 6, 5
...
}
Which unclutters the code allot when you have many return's in a function http://play.golang.org/p/2kEKXq-kUV