DEV Community

Discussion on: My Favorite Go 2 Proposals

Collapse
 
agrim profile image
Agrim Prasad

Nice little collection you've got there. I agree that the casing issues should be fixed, although this shouldn't be a high priority since you can always set up your editor to auto-complete this stuff for you.

I'm meh about interface literals to be honest. Making the sorter a separate type makes it more re-usable in my opinion.

The collect statement is sort of try-catch again, isn't it? The problem with these kind of catch-all statements is that developers end up writing hundreds of lines of code in the block, and then you are left wondering about where exactly the error was encountered (especially when using error tracking software such as Rollbar or Sentry)

Collapse
 
dean profile image
dean

I really like the idea of interface literals, mainly for the reason that it groups code where it gets executed. It is nice to force re-usability though.

I agree with the critique on collect though, and I personally don't think it's going to go through. I know a lot of people are unhappy with Go's error handling for several reasons though, so I personally think it may be a step in the right direction, although I'm more of a fan of including github.com/pkg/errors into the standard library, which is a separate proposal. (I didn't include it in here since I believe it could instead just be added in Go 1)