Live data from Hacker News

Go is my hammer, and everything is a nail

maragu.dev

161–170 of 816 posts

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

#161
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…

I would rather go had real enums, and I would _prefer_ if there were sum types. I agree it's more verbose, but I don't find that that verbosity really bothers me most of the time. Is res= [x for x in foo if "banned" in x] really actually more readable than var result []string for _, x := range foo { if strings.Contains(x, "banned") { result = append(result, x) } } ? I know it's 6 lines vs 1, but in practice I look at…

I argue:

- The list comprehension is ever slightly more readable. (Small Positive)

- It is a bit faster to write the code for the Python variant. (Small Positive)

So this would be a small positive when using Python.

Furthermore, I believe there is this "small positive" trade-off on nearly every aspect of Python, when compared to Go. It makes me wonder why someone might prefer Go to Python in almost any context.

Some common critiques of Python might be:

- Performance in number crunching

- Performance in concurrency

- Development issues in managing a large code base

I believe the ecosystem is sufficiently developed that Numpy/Numba JIT can address nearly all number crunching performance, Uvicorn w/ workers addresses concurrency in a web serving context, ThreadPool/ProcessPool addresses concurrency elsewhere, and type hints are 90% of what you need for type safety. So where does the perceived legitimacy of these critiques come from? I don't know.

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

#162
post #140

Earlier quoted context omitted.

Not sure what you mean by "no generics on interfaces"? https://go.dev/play/p/jGINeUt1JTE Also echoing not sure what you mean by "no consistency in formatting or imports". It is increasingly difficult to use Go without gofmt getting run, since I have to imagine fewer and fewer people nowadays are using an editor that has neither custom support for their language nor LSP integration, and integration with gopls automati…

> Not sure what you mean by "no generics on interfaces"? I didn't word this very well. You can have a generic interface, and functions on that interface can refer to generic types. But you can't have a generic method on an interface that uses a different generic type. For example you can't have: ``` type YieldThing[T any] interface { Yield() T DoOperation[U any](U) } ```

There are good reasons for not allowing generic methods:

https://go.googlesource.com/proposal/+/refs/heads/master/des...

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

#163

Earlier quoted context omitted.

I'm genuinely curious which language you see as having a better development time. I don't mean that as arguing, I'm actually curious. I don't know much about Go but I just began learning it 2 days ago. I'm already 50% of the way done through a really nice TUI app, and I haven't even touched the docs. To me at least, it feels extremely productive so far.

Developing with Python is faster.

When leaning on libraries pushing what's new in computer science, like certain facets of machine learning as a prominent example, which generally aren't found outside of the Python ecosystem, certainly. But head-to-head on well-trodden computer science paths, Python doesn't stand a chance.

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

#164
post #34

> all popular programming languages can do basically anything That's just very not true...

We need some example here, otherwise any language can generate code in the target language to do anything. And in the end all languages generate machine code one way or another so thats pretty much the same thing.

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

#165

Earlier quoted context omitted.

Thanks for posting this. It’s an unfortunate choice of “one hammer to rule them all” given Go does not offer necessary coverage at both low and high ends of abstraction (and performance) the way C# does. For me, it’s a similar kind of hammer. (I prefer to think of it as a crowbar ;D)

The problem with C# is its created by Microsoft, even if its a good language its hard to look at it and not think how much its limited while used outside of Windows.

It seems that you might be asking this question in bad faith.

But on the off chance you are not, please find previous replies that address the same kind of question below:

https://news.ycombinator.com/item?id=41037792

https://news.ycombinator.com/item?id=41189309

https://news.ycombinator.com/item?id=41211767

https://news.ycombinator.com/item?id=41197493

https://news.ycombinator.com/item?id=41218353

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

#166

Earlier quoted context omitted.

Obviously but if you look at a lot of Go projects you tend to see it. Especially in a corporate space. It should be obvious that I'm referring to things that you see in a professional environment with professional standards. I'm getting a lot of hate where that seems to be lost on people. And even if someone is a solo developer I don't assume that they don't ever have to work with other people's code -- that certainl…

Because you are attributing things that are common in enterprise environments (Bazel, monorepos, and Protobufs) to Go. It's fine if you hate these things, but saying that these are the defaults of Go isn't right, and I bet that's why people are hating on you. There's nothing default about them in Go. If you work with enterprise-y code, it shouldn't be surprising that a lot of them are going to follow Google's steps.

Go was designed for use in enterprise environments. It was literally designed for Google's specific development problems.

Nothing about Go's design should be talked about divorced from the context of it being tailor-built to solve Google-specific problems.

All other uses of Golang are basically in the territory of rounding error.

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

#167
post #99

Earlier quoted context omitted.

It feels extremely strange to see Go described as a "hype" language. It was somewhat hyped around seven years ago, which is when I started using it almost exclusively. Before that, it had a strong hype peak about fourteen or fifteen years ago, just after it was born. However, it's not a young language any more. At this point I would actually submit the opposite criticism: it is a mature language which is perhaps star…

Count the number of posts with Go in the title, vs any other programming language. It easily beats out everything both here and on lobsters.

Maybe, but 80% of those are complains of some sort.

That's the opposite of hype.

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

#168

Earlier quoted context omitted.

I would rather go had real enums, and I would _prefer_ if there were sum types. I agree it's more verbose, but I don't find that that verbosity really bothers me most of the time. Is res= [x for x in foo if "banned" in x] really actually more readable than var result []string for _, x := range foo { if strings.Contains(x, "banned") { result = append(result, x) } } ? I know it's 6 lines vs 1, but in practice I look at…

The new lines were eaten so it does make the python version more readable but I agree with you.

Thanks - updated!

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

#169

I've been coding in Go for over five years. I like Go, but I don't love it. It's never my first choice, although I don't advocate for rewrites just to move away from it. The tooling is a mess. Go modules still feel like a 'first pass' implementation that never got finished. There's no consistency in formatting or imports (even though Go claims there is). Generics are a good step but are still very primitive (no gener…

Not sure what you're comparing to, but Go modules are probably the best dependency management system in any language.

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

#170
post #169

I've been coding in Go for over five years. I like Go, but I don't love it. It's never my first choice, although I don't advocate for rewrites just to move away from it. The tooling is a mess. Go modules still feel like a 'first pass' implementation that never got finished. There's no consistency in formatting or imports (even though Go claims there is). Generics are a good step but are still very primitive (no gener…

Not sure what you're comparing to, but Go modules are probably the best dependency management system in any language.

[dead]
Post reply on HN