Go vs JavaScript: Why Simplicity Wins

Go vs JavaScript: Why Simplicity Wins
Photo by Eliézer Fernandes / Unsplash

I’ve been playing with Go recently — not just reading about it, but actually building things. And honestly, I’m impressed. Not in a “oh this is neat” way, but in a why aren’t more languages like this? kind of way.

It’s not about syntax. It’s about how Go’s design respects your time.

Let’s start with something small but powerful: in Go, if you write a function like this:

package main

func SetupRouter() {}

Boom — SetupRouter is exported. No export keyword. No default vs named exports. No module headaches. Just capitalize it. That’s the rule. And that one rule covers all types, functions, and variables.

In contrast, JavaScript gives you a buffet of ways to export and import:

// CommonJS
module.exports = function setupRouter() {}

// ESM named export
export function setupRouter() {}

// ESM default export
export default function setupRouter() {}

You get flexibility, sure — but with it comes complexity. And worse, the rules vary by environment.


The Package System: Invisible Imports, Zero Friction

Go goes further. All files in the same package can use each other’s functions without imports. You just write them. They're there.

// fileA.go
package main

func DoSomething() {}

// fileB.go
package main

func Use() {
    DoSomething() // just works
}

That’s it. No import './fileA'. No circular dependency pitfalls. No bundling surprises.

In JavaScript, even in the same folder, you’d need:

// fileB.js
import { DoSomething } from './fileA.js';

DoSomething();

And if you mess up the extension or file path or export syntax? You’ll find out at runtime (or during bundling).


One Runtime Model vs The JavaScript Triangle of Pain

Here’s the thing: Go has one way to run. One module system. One entrypoint (main). Done.

JavaScript? You’re often juggling between:

  • CommonJS (require)
  • ESM (import)
  • Global scripts (window.DoSomething = function () {}...)

Each of these has different rules for how modules work, how code loads, and how dependencies resolve. And converting between them? That’s a trap.

Ever tried to use a CommonJS module inside an ESM project? Or import an ESM-only package in a Node.js app that still runs CJS? Or embed a module in a <script> tag only to get an error because you forgot type="module"?

Exactly.

Go just runs.


Tooling That Doesn't Fight You

Another thing that struck me is how consistent and helpful Go’s built-in tools are. go fmt formats your code. go test runs your tests. go build compiles your app. go run executes it. go mod manages dependencies.

No configuration. No webpack.config.js, .babelrc, .eslintrc, or 20 variations of tsconfig.json. No “just use this plugin to make that plugin work with this tool.” You don’t lose half a day tweaking a bundler. You just write code and it runs.

And the compile times? Stupid fast.


A Design Philosophy You Can Feel

Go wasn’t built to be clever. It was built to be clear. That shows in decisions like:

  • Only one looping construct: for — no while, do...while, forEach, map, or other sugar
  • Error handling that’s explicit and linear — no try/catch gymnastics
  • Minimal syntax, enforced formatting, and no semicolon drama

Some developers complain that Go is “too simple.” But when you’re building software — especially for the long run — simple is powerful.

Compare this to JavaScript, where even small differences in syntax (== vs ===) or behavior (this binding inside arrow functions vs regular ones) can introduce subtle bugs.


In the End, Go Feels Like a Well-Designed Tool

When you build with Go, you feel like the language is on your side. It has opinions, and they’re good ones. You’re not constantly second-guessing your environment or structure. You can open a Go project and understand it in minutes.

With JavaScript, that same clarity can take hours — and only if you know whether the code is running in the browser, in Node, in Deno, in Vite, or behind 17 layers of build tooling.

JavaScript is wildly flexible, but that flexibility comes at a cost. Go bets on consistency and predictability, and it pays off. It's not flashy, but it's reliable — and honestly, that’s a superpower.

So yeah, I’m impressed. And a little jealous I didn’t pick it up earlier.

Support Us