News for hackers. Stuff that matters.
Re:Go 1.19 Beta 1 is released by BreakfastB0b on Saturday June 11, 2022 @03:58AM (#31702780)
Concurrency is a major stumbling block https://eng.uber.com/data-race-patterns-in-go/. Mutexs, conditional variable subtleties, wait groups, null pointer propagation, partial struct initialisations, channel lifetime coordination. tl;dr shared memory concurrency is hard.

The introduction of generics should make it easier to wrap these lower level concurrency primitives into higher level safe constructs without needing code generation or runtime type casting via interface{}.

Most devs also struggle to structure go programs in a way that makes them easily testable, but that’s true in a lot of languages.

Re:Go 1.19 Beta 1 is released by ainar-g on Saturday June 11, 2022 @04:12AM (#31702826)
Concurrency is hard generally, so I agree with that.

> The introduction of generics should make it easier to wrap these lower level concurrency primitives into higher level safe constructs without needing code generation or runtime type casting via interface{}.

That process has actually already begun with Go 1.19's sync/atomic.Pointer[T]. See https://pkg.go.dev/sync/atomic@master#Pointer. Things like easier non-blocking send and receive or easier fan-in and fan-out channels should probably follow suit.

Re:Go 1.19 Beta 1 is released by morelisp on Saturday June 11, 2022 @03:48PM (#31707644)
> Most devs also struggle to structure go programs in a way that makes them easily testable, but that’s true in a lot of languages.

My experience especially relative to Java is the opposite - between httptest and sqlmock and the ease of setting up listeners in a separate goroutine, it's easy even for new Go developers to create new, realistic request-to-response functional (behavioral / Detroit-style / whatever they're called today) tests.

On the other hand, getting our long-time Java devs to hook up a reasonable wiremock test is like pulling teeth. They much prefer piles of redundant unit tests with a few Spring-injected "integration tests" against H2 and an in-process gRPC "endpoint" or whatever, that of course therefore aren't testing much integration at all.