Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
Learn a Programming Language  ›  Lesson

Go and Rust — Tools That Ship as One File

Go 12 minGo and Rust compile to native binaries that run without an installed runtime, which makes them easy to ship to many machines, with Rust adding memory safety without a garbage collector.

Go and Rust — Tools That Ship as One File

Your Python health check works, and now fifty servers need it. Some have Python 3.8, some 3.12, one has none. Copying a script is easy; copying a working interpreter plus its libraries everywhere is not. This is exactly the problem compiled languages solve.

The rule

Compile once into a single binary; the target needs nothing else installed.

A compiled language turns your source code into a machine-code file ahead of time. Go goes further: by default it bundles the libraries your program uses into that one file. You copy it to a server and run it. No interpreter, no pip install.

Go can also cross-compile: from your laptop you can build a program for a different operating system and processor by setting two variables.

GOOS=linux GOARCH=amd64 go build -o healthcheck .
GOOS=linux GOARCH=arm64 go build -o healthcheck-arm .

That is why so much DevOps tooling is written in Go: Docker, Kubernetes, Terraform and Prometheus are all Go programs. Go is also simple on purpose, with built-in support for running many tasks at once, which suits network tools.

Rust also compiles to fast native binaries. Its headline feature is memory safety without a garbage collector: the compiler refuses code that could read freed memory or race on shared data. That makes it attractive for performance-critical, long-running tools, such as proxies and command-line utilities like ripgrep. The price is a steeper learning curve than Go.

The shortcut

Ask one question: does the machine that runs it need a runtime installed?

  • Python, Ruby, Node.js: yes. The server needs the interpreter and the right packages.
  • Go, Rust: no. Ship the binary built for that operating system and processor.

If the answer "yes" is a problem, because many machines, mixed versions or a minimal container, reach for a compiled language.

Shipping a checker to fifty serversStep 1 of 4
  1. Look at the targets

    Forty-eight servers are Linux on x86-64, two are Linux on ARM. Their Python versions differ.

The trap: a binary is built for one operating system and processor. An ARM build will not run on an x86-64 server, so name your files clearly.

Drills

Answer fast — trust the rule.

quick drill

Which command builds a Go program for Linux on 64-bit ARM?

quick drill

In which language are Docker and Kubernetes mainly written?

quick drill

What is Rust's best-known advantage for low-level tools?

quick drill

A Python script runs fine on your laptop. What must the server have to run it too?

Remember

  • Compile once into a single binary; the target needs nothing else installed.
  • Shortcut: "does the target need a runtime?" If that hurts, compile.
  • Trap: a binary only runs on the operating system and processor it was built for.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainScript or binary?

You must run a small checker on fifty servers with mixed Python versions, two of which use ARM processors. Explain whether you would ship a Python script or a Go binary, and how you would build for both processor types.