Live data from Hacker News

Go is my hammer, and everything is a nail

maragu.dev

341–350 of 816 posts

Re: Go is my hammer, and everything is a nail

#341
post #262

Earlier quoted context omitted.

Also: interfaceiritus. Someone saw "accept interfaces, return structs" somewhere and now EVERYTHING accepts an interface, whether or makes sense or not. Many (sometimes even all) of these interfaces have just one implementation.

Doing this allows you to mock out that implementation in unit tests.

I agree with your point. OP wrote:

    > Many (sometimes even all) of these interfaces have just one implementation.
They are missing that mocks are the second implementation. (It took me years to see this point.) I would say that in most of my code at work, 95+% of my interfaces only have a single implementation for the production code, but any/all of them can have a second implementation when mocking for unit tests.

Re: Go is my hammer, and everything is a nail

#342
The article claims Go supports building GUI apps and links to this.

>Wails is a project that enables you to write desktop apps using Go and web technologies

At that point why not just use Electron and Node JS.

I like Golang, I truly do. But after building mobile apps in both Golang and Fluter, I'm well aware of Go's limitations.

Making anything look remotely nice is painful. Things get really difficult when you use the wrong tool for the job.

A much better argument could be made for JavaScript being a language that can do anything. Even then when ever you run npm install you need to pray the house of cards that is modern JavaScript doesn't collapse.

C# is also a contender, but people, particularly the FOSS crowd doesn't like it because Microsoft == Bad.

Re: Go is my hammer, and everything is a nail

#343
post #290

Earlier quoted context omitted.

I do programming interviews and I found candidates struggling a lot in doing http request and parsing response json in Go while in Python its a breeze, what makes it particularly hard, is it lack of generics or dict data type?

It comes down to how the standard library makes you do things. I don't think there's any reason why a more stringly-typed way of handling JSON (or, indeed, a more high-level way of using HTTP) is outside of the realm of possibility for Go. It's just that the standard library authors saw fit not to pursue that avenue. This variability is honestly one of the reasons why I dislike interviews that require me to synthesiz…

I like your story about debugging during an interview. I can say from experience, you always have one teammate that can just debug any problem. I am always impressed to watch and learn new techniques from them.

Re: Go is my hammer, and everything is a nail

#344
I really want to love Go for side projects but it’s just so verbose and time consuming.

I understand that a framework with ”batteries” goes against Go principles, but coming from Rails, which solves the common boring problems for me, Go just makes it too much of a pain.

At least as far as web dev goes, I’m sure Go is great for other stuff.

Re: Go is my hammer, and everything is a nail

#346

Earlier quoted context omitted.

And, if you hate strong typing, there's always map[string]any.

Really, the mismatch is at the JSON side; arbitrary JSON is the opposite of strongly typed. How a language lets you handle the (easily fallible) process of "JSON -> arbitrarily typed -> the actual type you wanted" is what matters.

    > arbitrary JSON is the opposite of strongly typed
On the surface, I agree. In practice, many big enterprise systems use highly dynamic JSON payloads where new fields are added and changed all the time.

Re: Go is my hammer, and everything is a nail

#347

I really want to love Go for side projects but it’s just so verbose and time consuming. I understand that a framework with ”batteries” goes against Go principles, but coming from Rails, which solves the common boring problems for me, Go just makes it too much of a pain. At least as far as web dev goes, I’m sure Go is great for other stuff.

Back in 2012 or sometime around it, I was trying Akka a Java library and trying concurrency and stuff. Around the same time I gave Go a try and it was much less verbose and simple. Never looked at Java after that, but I never felt Go is verbose.

Re: Go is my hammer, and everything is a nail

#348

Earlier quoted context omitted.

One of the most important qualities of Go is that it is actually possible to fully understand the language -- in the sense that you never see a snippet of Go code and think "wtf, you can do that?" or "hang on, why does that work?" Getting to that point takes many years, to be sure. But the language is simple enough, and changes slowly enough, that it is not an unrealistic goal -- the way it would be in C++, or Rust,…

> in the sense that you never see a snippet of Go code and think "wtf, you can do that?" or "hang on, why does that work?" I am extremely doubtful that this is true and would like evidence.

kind of hard for someone to prove a negative - feel free to find some Go code that meets that definition.

Re: Go is my hammer, and everything is a nail

#349
post #94

People always under-estimate the cost of properly learning a language. At any given time I tend to have a "main go-to language". I typically spend 2-4 years getting to the point where I can say I "know" a language. Then I try to stick to it long enough for the investment to pay off. Usually 8-10 years. A surprising number of people think this is a very long time. It isn't. This is typically the time it takes to under…

It’s not just the time to understand those nuances, but to keep up with the pace of changes. There’s an aspect of navigating those in some languages (JS…) that can be time consuming depending on where it’s deployed.

Not only is it the nuances and pace of changes, but theres also a temporal element of seeing cause and effect over time from within an ecosystem. Is there a way to just parachute in and learn how to judiciously use classes in JavaScript the way one would if they were out there assigning Thing.prototype.method = function () {}? Can Udemy give you the same a-ha moment learning Promises today that someone got when they were drowning in callback pyramids in their Express v3 app?

Re: Go is my hammer, and everything is a nail

#350
post #262

Earlier quoted context omitted.

Also: interfaceiritus. Someone saw "accept interfaces, return structs" somewhere and now EVERYTHING accepts an interface, whether or makes sense or not. Many (sometimes even all) of these interfaces have just one implementation.

Doing this allows you to mock out that implementation in unit tests.

A lot of times you want to be able to cmd+click on something and actually see what the hell the code actually does and not get dead-ended at an interface declaration.
Post reply on HN