Live data from Hacker News

Ask HN: What do you like/dislike about Golang?

news.ycombinator.com

91–100 of 111 posts

Re: Ask HN: What do you like/dislike about Golang?

#91

Earlier quoted context omitted.

This seems to only be a complaint about a particular (granted, default) proxy for downloading modules, and no criticism of the actual module system (which does not depend on a proxy) nor the idea of a proxy (which is pretty easy to run, especially when compared to most other languages' package repositories). As to the criticism, if a public module isn't playing well with the default proxy, it's a good sign I don't wa…

> about a particular (granted, default) proxy Yeah, but defaults matter. That's one of Go's big selling points, usually. > As to the criticism, if a public module isn't playing well with the default proxy, it's a good sign I don't want to use it to begin with. The concern raised here is more that things only work because the proxy masks problems. Also alluded to is that said default proxy is kind of awful to its upst…

> The concern raised here is more that things only work because the proxy masks problems.

But making the modules available in the face of upstream breakage is a point of the proxy. I can still build when GitHub is down. I can still get the version of the source I expected when upstream rebases or retags. Those are reasonable defaults. And with one env var I can also turn that off and check that the upstream is still as I expect.

> Also alluded to is that said default proxy is kind of awful to its upstreams

This is debatable; sr.ht seems to want to host a lot of go repos but not have people pull a lot of go repos. I'm not sure that's a case worth catering too.

Re: Ask HN: What do you like/dislike about Golang?

#92
post #80
post #22

Earlier quoted context omitted.

> As someone who likes async/await/coroutines, I really miss them in Go Interesting. Most complain about languages with async/await and say they want goroutines. What is it about async/await that you prefer over Go's approach?

Async/await allows you to be much more explicit about dependencies. I don’t care what thread executes something, but I do care that e.g. these three network requests happen in parallel. With async/await I can explicitly use an ‘await Promise.all(a, b, c)’ where Go would need a new channel and goroutines, etc. all being implicit, so it’s hard for the reader to know what the intent is, and it’s error prone, who knows i…

This is a weird example as Promise.all and Promise.race are what are pretty easy to write in Go:

Promise.all is trivial:

    return 
Promise.race is a little longer:

    select {
        case x := 
What Go doesn't do very well compared to promises is composing; composing channels, especially with error returns, is usually tricky. But async/await are also bad at this. Passing around the actual promise/futures objects is the best way, which is for some reason discouraged today in favor of await/async noise in most cases.

Re: Ask HN: What do you like/dislike about Golang?

#93
post #43

LIke: - Decent speed of compiling and execution. - Expressiveness. - I like the struct/receiver/interface interplay to create an analog of classes. - Nice standard library. - Cross compilation. Things I wish for: - Ternary operator. - Something a bit closer to inheritance. Embedding structs in other structs fools you into thinking there's inheritance, but you quickly learn that it doesn't work the way you think it wi…

> LIke: - Expressiveness.

Isn't Go deliberately not very expressive?

Re: Ask HN: What do you like/dislike about Golang?

#94

Like: The package and build system is amazing and just works. Simple, yet intuitive and powerful with the introduction of modules. It's hard to quantify the number of hours I've saved over other tools hunting down build/linker/dependency management issues. Dislike: Error handling feels extremely verbose. I like the design choice to return errors explicitly, but it feels like there needs to be a return-if-error syntac…

> Like: The package and build system is amazing and just works.

I don't have much experience with go, but that's not at all my experience. I had the compiler panic on me for daring to run "go get", as described here: https://github.com/golang/go/issues/47979

This issue has now been closed, but there are several others open with the same symptoms. The response by a golang maintainer was:

> It seems likely that there is still a bug here, but the code is complex enough that we're unlikely to find it by just reading through the code.

Anecdotally, i've tried to fork the imported module to remove some dependencies i was not using, and failed miserably, as explained here: https://github.com/ooni/probe-cli/pull/986#issuecomment-1327...

I have experience with C/Rust import systems and i can say with 100% confidence that golang's module system is far from amazing.

Re: Ask HN: What do you like/dislike about Golang?

#95
post #88

Earlier quoted context omitted.

How do you ensure that a language with explicit interfaces implements what the expected behavior is?

It is a kind of honour system, the developer has explicitly stated, yes I want to comply to interface XYZ, instead of doing it by accident and due to copy-paste error passing the wrong one, ensuring a couple of debugging hours tracking down where the error lies in code that compiles without any issues. Typical debugging problem in dynamic languages.

> the developer has explicitly stated, yes I want to comply to interface XYZ, instead of doing it by accident

To be honest, it's pretty hard to implement an interface by accident. You'd have to specifically implement methods with specific names and type signatures.

If method names + type signatures don't intuitively specify how should implementation behave, then it's either a bad interface or a trivial one.

Re: Ask HN: What do you like/dislike about Golang?

#96
I'm new to golang, but i've had bad experiences with it so far compared to other languages.

- method declarations are hard to grep for because the related struct appears before the method name (like "grep 'func String'" will not find "func (s Struct) String"), and because a module's types/functions can be declared across several files

- many pointer-related footguns, many others have mentioned the nil pointer exception issue, but as a newcomer to golang i found it confusing that i could accept value params in methods/functions and mutate those params... only to have those mutations silently discarded because they were a copy of the original data to start with

- do you even concurrency?! i ran into a deadlock by using the stdlib in a very simple way, in a sequential manner, in a single-threaded program. i still have no clue why that is, and the program maintainers don't either. i'm probably doing it all wrong, but it was so easy to shoot myself in the foot. If someone more experienced wants to teach me what i did wrong, here's the code: https://github.com/ooni/probe-cli/pull/989#discussion_r10325...

- the module system is entirely broken: i've had the go command panic* on me for simply using "go get"... the problem is old and well-known, and has quite a few tickets open on the golang bug tracker: https://github.com/golang/go/issues/47979

- the attributes exposed by marshaling libraries are different from one library to the next... i mean that's a problem in most languages but after trying out serde.rs briefly i feel like that should be the way in every language to just standardize those fields

- golang is not structured for commenting out parts of the code to test something quickly: unused imports/variables is a compilation error, and apart from naming a variable "_" there is no way to ignore its usage (using "_" as a prefix like in rust would be an awesome addition)

- struct declaration and instantiation has inconsistent syntax: why would i use comma after a field instantiation but not after a field declaration?

- the difference between ":=" and "=" is clunky... as you refactor code you end up having a lot of this variable doesn't exist, or this variable already exists kind of error... i understand the need for proper variable instantiation and type declaration in general, however ":=" does neither as you require an entirely different syntax (var) for explicit types, and golang is very happy with passing around nil/empty values

- publicity based on case makes it super hard to decide later whether you want a method/field to be public because you need to change the entire API, instead of simply adding a keyword

- no standard way to define default fields for a struct? there may be one but across all libraries i've used so far there was weird NewStruct() or NewDefaultConfigStruct() methods which were hard to grep for in the docs/code

All in all, it's not the worst programming language i've used. JavaScript is a lot worse. But from a week of working with it full-time, i feel like go has massively failed at being a better C or a better Python... it feels to me like it combined the failure modes from both ecosystems into a new rather incoherent language.

If you're looking for quick scripting, i would still recommend Python or PHP which in my humble opinion have much better developer UX. If you're looking for serious systems programming, i would recommend Ocaml, Rust, or plain old C, all three of which have amazing tooling. It may be weird to recommend C as an alternative to golang, because C is so low-level it's easy to shoot yourself in the foot... but that's the thing, C does not try to pretend to be a safer high-level language, it gives you raw tooling. golang tries to be higher-level but i think it failed at that.

Sorry for the rant, i don't mean to be rude. I just don't understand the hype around golang.

Re: Ask HN: What do you like/dislike about Golang?

#97
post #62

Like: - `go generate` for embedding resources into the executable. So intuitive and beautiful. - Strict curating. It's the kind of language that things don't get into unless they're the right solution. - Performance! Python was my favorite language before Go got sufficiently mature. It was refreshing to have that much efficiency coming from Python. - `if err != nil {`, dammit! - Imports referring to the location wher…

> If we could make generic types

What do you mean by this? Methods?

Re: Ask HN: What do you like/dislike about Golang?

#98
I migrated my scrapers from Python + BeautifulSoup to Go + Colly and it was a pleasure: the new programs are impressive fast (1/3 of the time) and managing the concurrency and parallelism is a lot easier in Go that messing up with asyncio. Even the dependency management is a pleasure, no need for virtualenv or other tools.

If there is something that I don't like it's the serialize/deserialize of JSON objects: you need to know the structure of JSON in advance and define in your struct. When you are scraping an unofficial API and this change silently, this can be a pain.

Re: Ask HN: What do you like/dislike about Golang?

#99
Like:

Errors as values. Would I prefer Results/Options baked into the language? Yes. Am I glad we don’t have to deal with exceptions? God yes.

Stdlib, the ecosystem, and globally the mentality of the community regarding dependencies.

Mostly self contained binary that’s easy to (cross) compile and deploy

Performance

Dislike:

Lack of ternary expressions

Lack of some standard interfaces (Iterable is a big one)

Re: Ask HN: What do you like/dislike about Golang?

#100

I'm new to golang, but i've had bad experiences with it so far compared to other languages. - method declarations are hard to grep for because the related struct appears before the method name (like "grep 'func String'" will not find "func (s Struct) String"), and because a module's types/functions can be declared across several files - many pointer-related footguns, many others have mentioned the nil pointer excepti…

You'd still recommend PHP for scripting? The developer ux of php is miles behind compared to Go, though I suppose it depends what we mean by it.

Composer is clunky as hell and Concurrent scripts are just a big fat no in PHP. I need concurrency a lot in my line of work yet my colleagues never wrote concurrent code in their life so they have no idea what they're missing out on.

Post reply on HN