News for hackers. Stuff that matters.
Re:One Year After Switching from Java to Go: Our Experiences by roncesvalles on Wednesday February 19, 2025 @02:54AM (#43099736)
The idiomatic way to write Go is as naively as possible after you fully understand how it works. Otherwise it'll just feel like Java with shitty ergonomics.

If you're ever writing Go and wish you had real classes instead of this deconstructed "mess" with struct types, methods, and interfaces, you're writing Go totally wrong.

Re:One Year After Switching from Java to Go: Our Experiences by gf000 on Wednesday February 19, 2025 @05:47AM (#43100727)
Sounds like a no true Scotsman fallacy.
Re:One Year After Switching from Java to Go: Our Experiences by unscaled on Wednesday February 19, 2025 @07:37AM (#43101395)
That is certainly one way to write Go, but I wouldn't call it "idiomatic" when evil the Google Best Practices guide recommends against it[1][2]. I'll wager you'll probably find it in most other Go style guides. This is how the Go standard library itself works. While you can use http.Get() if you want to use the default HTTP client for simple apps, the library provides you the http.Client struct, where you can also override the Transport (RoundTripper interface) and Jar (CookieJar interfaces). The transport interface lets you further override the Dialer and Proxy function.

[1] https://google.github.io/styleguide/go/best-practices#global... [2] https://google.github.io/styleguide/go/best-practices#provid...

Re:One Year After Switching from Java to Go: Our Experiences by roncesvalles on Wednesday February 19, 2025 @08:07AM (#43101709)
>This document is neither normative nor canonical