if err != nil { return nil, err; }
as a well-formatted line of go? Make it a special case somehow.My only big problem with if err != nil is that it eats up 3 lines minimum. If we could squish it down to 1, I'd be much more content.
if err != nil { return nil, err; }
as a well-formatted line of go? Make it a special case somehow.My only big problem with if err != nil is that it eats up 3 lines minimum. If we could squish it down to 1, I'd be much more content.
All of that aside, I've come to learn that passing errors up the call stack without any wrapping or handling is a code smell. It is less than useless for me to attempt setting the value of cell A1 in an Excel sheet to "Foo" and then receive an out-of-range error because the developer made no attempt to even inform me of the context around the error. Let alone handling the error and attempting to correct state before giving up.
In my Excel example, the cause of the error was a data validation problem a couple columns over (F or so). The error was legitimately useless in troubleshooting.
you are proposing changing this, making code look different based on differences of opinions between developers
go fmt is actually one of the top rated features of Go, it makes everyone's code look the same, everyone has nitpicks about it, yet by and large it is one of the most loved things about Go. Breaking this is even less likely than changing error handling
fmt.Printf("%s %s %s %s\n", arg1, arg2, arg3, arg4)
and this fmt.Printf("%s %s %s %s\n",
arg1, arg2, arg3, arg4)
and this fmt.Printf(
"%s %s %s %s\n",
arg1,
arg2,
arg3,
arg4,
)
and will not alter any of the above. All I want is similar ambiguity around one-line `if` statements. That's not so crazy.