3 ms·
x := something() n := somethingElse(x) andSoOn() This won't compile in Go. x, err := something() n, err := somethingElse(x) andSoOn() This won't co
by dchest 14y ago
x := something()
n := somethingElse(x)
andSoOn()
This won't compile in Go.
x, err := something()
n, err := somethingElse(x)
andSoOn()
This won't compile in Go as well (compiler requires that you use the variables you declare).
You can only explicitly ignore errors:
x, _ := something()
n, _ := somethingElse(x)
andSoOn()
Except for one case where error is the only returned value.
err := fmt.Println("")
_ = fmt.Println("") // ok
fmt.Println("") // ok