Live data from Hacker News

Go is my hammer, and everything is a nail

maragu.dev

451–460 of 816 posts

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

#451
post #275

Life is barely long enough to get good at one thing so you should choose your thing wisely. That's wisdom I've held for quite some time. Coincidentally, I chose Go as my language of choice as well. The factors that led me to that choice were many, but to highlight some: - incredible standard library - simple to read and write - single static binary builds (assets included, like html/images, etc) - don't need a contai…

I chose C# for the same reasons. It's probably easier to make C# unreadable than Go due to plethora of features, but it all comes down to how you discipline yourself about writing code.

"it all comes down to how you discipline yourself about writing code."

I don't think controlling one's own code is a problem. I'm more worried about the opportunities the language gives for Bob (my junior coworker) to slowly introduce all sorts of unclear cutting-edge language nonsense. Go is pretty good for this in my opinion.

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

#452
post #217

Earlier quoted context omitted.

> The average developer won't see these things, they're typically just writing glue code between Go's great stdlib (which also contains wild things if you take a look) and other 3rd party dependencies. This is what most of us are doing every day, and exactly what Go excels at.

If you want to progress your career you'll need to take on hard problems at some point. Go isn't particularly unique in excelling at easy problems.

Go doesn't excel at easy problems. Go is fine at pretty much everything. Do you think Kubernetes is an easy problem?

The thing is just that Go is very opiniated in its feature set. That's you see people here writing about complex projects using "wild" or even "god awful" things, and lament the inability to properly map API boundaries in the language.

The truth is obviously that all of these is not particularly wild. It's just things that the commenter considers inelegant but is perfectly able to follow which is Go strength and why it's so code. Want it or not, you will have to write code that someone else can follow.

Don't get me wrong, I'm not going to pretend that Go is in anyway perfect or has the correct feature in as much as that exists. I probably enjoyed writing Ocaml more. But in practice, for a large scale project where collaboration is important, using Go is an awesome experience.

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

#453

None of these reasons are specific to Go. They apply just as well to any Turing complete programming language. Not to say the arguments are bad. Just that the argument is for picking one tool and using it for everything to benefit from your investment in that tool across all your projects.

I wish "any Turing complete language" wasn't used as a catchphrase.

Especially that such a claim is so stinky. In what way the Brainfuck programming language environment is giving the coder same experience as Go, huh? Because, if it's not, I just invalidated your claim.

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

#454
post #356
post #235

Earlier quoted context omitted.

var res map[string]any err := json.Unmarshal(&res)

Uh huh....and what comes next? Trying to descend more than a couple of layers into a GoLang JSON object is a mess of casts.

Well, one used to have https://github.com/mitchellh/mapstructure which assisted here, but the lib then got abandoned.

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

#455

Earlier quoted context omitted.

Go has maps, json parsing and http built in. I'm not exactly sure what this person is referring to. Perhaps they are mostly interviewing beginners?

Go maps have a defined type (like map[string]string), so you can only put values of that type in them. A JSON object with (e.g) numbers in it will fail if you try and parse that into a map of strings. As others have said, the issue with Go parsing JSON is that Go doesn't handle unstructured data at all well, and most other languages consider JSON to be unstructured data. Go expects the JSON to be strongly typed and r…

Umm, you can unmarshall into a map[string]any, you know ?

    dataMap := make(map[string]any)
    err = json.Unmarshal(bytes, &dataMap)

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

#456
post #136
post #95

Earlier quoted context omitted.

How is it different than, say, java for this generalist purpose?

As someone who isn't super proficient in Java I usually find Java daunting to get started with full of buckets of "meta" issues like in my other comment. What JVM do I use? Does it matter? Does it matter what version I install, what if I have to install/manage multiple versions? If I want to write a web service can I use vanilla Java stdlib or do I have to use Spring or some framework? If I use Spring, do I have to g…

Besides what neonsunset points out for .NET world, where alongside C#, we get the pleasure to enjoy F#, VB and C++/CLI, it is relatively easy for Java.

When one doesn't know, just like with Go, one picks up the reference implementation => OpenJDK.

For basic stuff, the standard library also has you covered in the jdk.httpserver module.

By the way, where is the Swing equivalent on Go's standard library?

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

#457
post #95

Earlier quoted context omitted.

How is it different than, say, java for this generalist purpose?

Just from an ergonomic standpoint it's a million times easier to deploy a go binary instead of a whole jvm and a jar file.

When it is a pure Go application, only as CLI or UNIX server.

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

#458
post #95

Earlier quoted context omitted.

How is it different than, say, java for this generalist purpose?

java on its own is not a competitor to go, IMO, due to the batteries included "culture" in the go ecosystem. I would need to compare it with, for example, Java + Spring(Boot). I find Go to be simpler and more pleasant to use.

Where is the GUI battery in Go?

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

#459
post #105

Go is everything I don’t want in a language for my personal projects. It’s verbose, every simple task feels like a lot to write. It’s not expressive, what would be a one-liner in Python makes you write three for loops in Go. I constantly need to find workarounds for the lack of proper enums, lack of sum types, no null safety etc. I’m sure these are the exact reasons why Go is good for enterprise software, but for per…

That's why I love Go so much. You want to write a very clever library using elegant abstraction and generics to have a cool innovative interface to solve your problem? Tough luck, you can't. So instead, you will just have to write a bog standard implementation with for-loops and good old functions which you will have to copy and tweak as needed where you really need something more complicated. It will work perfectly…

And yet they had to reach out to Haskell folks to fix their generics story.

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

#460

Earlier quoted context omitted.

Dude. Everyone knew what "real enums" meant including you . Please stop. And yes popular languages do have real type safe enums. C++, Typescript, Rust, god even Python.

> And yes popular languages do have real type safe enums. Right, as we already established, but which is only incredibly narrow support within the features in question. While you can find safety within the scope of enums and enums alone, it blows up as soon as you want the same safety applied to anything else. No popular language comes close to completing these features, doing it half-assed at most. We went over this…

> Are you just not familiar with programming?

I am very familiar with programming. The only things you've said so far have been attempts to redefine well-understood terms and now ad hominem and incoherent rambling.

If you don't have anything useful to say...

Post reply on HN