Skip to content
Typing Summit

Go typing practice

Type real Go: structs and methods, error handling with fmt.Errorf and an HTTP handler. Go code is full of := , braces, pointers and the if err != nil pattern.

3 snippets · key symbols: := { } * & != %

HTTP handler · Go
Press Enter at the end of each line. Indentation is filled in for you.
func hello(w http.ResponseWriter, r *http.Request) {↵ name := r.URL.Query().Get("name")↵ if name == "" {↵ name = "world"↵ }↵ fmt.Fprintf(w, "Hello, %s!", name)↵}
Guide

How to type Go faster

Go has its own set of symbols and patterns. Typing them in real code, with Enter and auto-indent like your editor, builds speed where it matters.

  1. 01

    Short declarations

    The := operator appears on almost every line of Go. It is two shifted symbols in a row, so it pays to make it automatic.
  2. 02

    Error handling

    if err != nil appears again and again. Typing it in one smooth motion keeps the flow of writing Go.
  3. 03

    Format verbs

    Printf and Errorf use verbs like %s, %d, %q and %w. The percent sign is a number row reach that many developers type slowly.

Questions people ask

2 answers

Does the practice use tabs or spaces?

+

Go uses tabs, but the practice shows four spaces and fills indentation for you, so you only type the code.

What is the hardest part of typing Go?

+

Usually the := operator, pointers with * and &, and format verbs with the percent sign.