logoalt Hacker News

jdw64yesterday at 5:55 PM2 repliesview on HN

I have a question: why do you think Go is better compared to other languages?

After all, learning a new language takes a lot of time. While basic syntax is common and quick to pick up, mastering a language's specific mental model requires a significant time investment, which is why I've used Go before but never seriously.

My interest was piqued recently when I heard about TypeScript tooling being ported to Go, and I know it is incredibly fast. However, where do the results claiming that AI agents generate superior Go code actually come from? Is it a fair, apples-to-apples comparison?

Since Go is a very small language with only 25 keywords, the way you write code is extremely standardized. Because of this, I would assume it naturally produces a lot of excellent best practices and conventions, but I'm not sure if there are actual, direct code examples proving this


Replies

jeanbzayesterday at 5:58 PM

> why do you think Go is better compared to other languages?

I didn't say that. :)

> where do the results claiming that AI agents generate superior Go code actually come from?

Like I said - reports from users.

> Is it a fair, apples-to-apples comparison?

No - these are reports from users, not a systematic analysis.

show 3 replies
mbreeseyesterday at 9:15 PM

Go is really amenable to being used to write code by LLMs. New code takes time to pick up, but the LLM is a quick study.

In my opinion, it has little to do with the speed of the language. The large quantity of source code to train on is quite helpful, but I think it's something else.

There are three things that I think make it well suited to LLM authorship -

1) static typing and a quick compiler - a variable can't change type after it's declared (unlike Python) makes Go more robust compared to dynamic languages. You (almost) always know what the type of a variable is. And the quick compiling with hard-stop errors means that the LLM gets a solid signal for each round.

2) It's quite opinionated, syntactically. There is generally one way that Go lang code is supposed to look. That means it's pretty easy to read as well as write. The lack of things like operator/method overloading make it an easy language to reason about.

3) the stdlib and limited dependencies. Dependency trees tend to be shallow, and because of the static linking (by default), you can generally be confident that what you wrote will run.