Blog / Engineering
From Hello World to HTTP Server: Your First Week of Go
The best first week with a new language is not the one where you read the most. It is the one where you finish something small every day, so that each morning starts from working code instead of good intentions. For Go, a realistic goal for week one is modest and satisfying: a tiny HTTP server, written by you, that answers requests in JSON. Everything you need is in the standard library — and the habits you build getting there matter more than the server itself.
A note on where this sits: this is a standalone taster week, not Ruqqy's Go Backend Development programme. The programme's Week 1 builds the foundations this week assumes — toolchain, types and strings, ending in a checkpoint quiz — and reaches HTTP in GO106 (Weeks 9–12), after structs in Week 3. The week below is still a sound way to taste Go in seven days; it just isn't the programme's first week.
Day 1: The toolchain and your first build
Install Go from the official site, then resist the urge to configure anything. Create a folder, run go mod init example/firstweek, and write the smallest program there is:
package main
import "fmt"
func main() {
fmt.Println("Hello, world")
}
Run it with go run ., then build it with go build and run the binary directly. That small difference — source you run versus an artefact you ship — is worth understanding on day one. So is gofmt: run gofmt -w . and let the tool settle every argument about formatting before it starts. Go programmers genuinely do this, and it is one reason Go codebases feel so consistent.
Days 2–3: Values, control flow, and honest errors
Work through the basics by writing programs, not by reading about them: variables and constants, if and switch, loops (Go has exactly one, for, wearing several disguises), arrays and slices, and maps. Then functions — and with them, Go's most distinctive habit: errors are values, returned like anything else.
func divide(a, b float64) (float64, error) {
if b == 0 {
return 0, fmt.Errorf("cannot divide by zero")
}
return a / b, nil
}
Check your errors where they happen. It feels verbose for a day, and then it starts to feel like the code is simply telling the truth about what can go wrong. Finish day three by running go vet ./... on everything you have written; treat anything it flags as a real bug until proven otherwise.
Day 4: Structs and methods
Group related data into a struct, and attach behaviour to it with methods. A small domain you care about works best — a task, a product, a booking. Add a constructor function that validates its input and returns an error for nonsense values. This is the shape of most real Go code: plain data, explicit validation, no magic.
Day 5: Your first HTTP server
Now the week's payoff. The net/http package needs no framework and no dependencies:
http.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
fmt.Fprintln(w, `{"status":"ok"}`)
})
log.Fatal(http.ListenAndServe(":8080", nil))
Start it, then ask it questions with curl. Add a second handler that reads a query parameter and answers with encoding/json instead of a hand-written string. Break it on purpose — request a missing route, send it a bad port — and read the errors. You now have a server; more importantly, you know what every line of it does.
Day 6: Make it a habit loop
Write a table-driven test for one of your day-three functions using the testing package, and run the full loop: gofmt, go vet, go test ./..., go build. This loop is the daily rhythm of professional Go work. It takes minutes, it catches embarrassment early, and it never stops being worth it.
Day 7: Read, review, plan
Spend the last day reading: the standard library source for one function you used, and a chapter of the official Effective Go document. Then write down what confused you during the week — that list is your week two syllabus.
One warning, from everyone who has taught this: do not spend week one comparing frameworks, editors or "Go versus X" threads. The language is deliberately small. A week of small, finished programs will teach you more than a month of preparation — and you will have a server to show for it.