Today's statistics

Completed exercises
-
Typed characters Typed words
-
Practice time
-

Overall statistics

Completed exercises
-
Typed characters Typed words
-
Practice time
-

Touch typing lesson: Programming in the Go language

Touch typing is important in programming. You are more efficient when you use fast typing techniques to write code in the Go programming language.

Let's learn more about the Go language and touch typing when coding in Go.

Coding in Go and touch typing

Programming in Go and touch typing can be practiced together. Go has a specific set of syntax rules and symbols that can be a challenge when typing quickly. Touch typing is about typing without looking at the keyboard, and in the context of Go it is important because the language requires accuracy: a missing brace or mistyped operator can cause a compilation error.

What is characteristic about Go syntax?

Go is a compiled language with a clean, minimalistic style. Its source code always starts with a package declaration. Imports can be declared individually or grouped in blocks. Functions are declared with the keyword func and use braces {} to delimit scope. Indentation does not define blocks in Go; go fmt applies standard formatting. Semicolons are usually omitted from the source, and the compiler inserts them at line breaks according to specific rules. This means that pressing Enter at the right place is not just a typing preference, but a rule in Go.

package main

import "fmt"

func main() {
 fmt.Println("Hello, Go")
}

Symbols to be mindful of

While typing Go code you will encounter certain characters repeatedly. Braces {} delimit function bodies and blocks in control statements. Parentheses () wrap function parameters and calls. Square brackets [] define slices and arrays. Quotes " and backticks ` are used for strings. The short declaration operator := is common when creating variables. Channels introduce the operator <-, which is less familiar on the keyboard and needs extra attention.

Variables and declarations

Unlike some languages, Go distinguishes between declaration with var and short variable declaration with :=. This operator combines colon and equals, which can be awkward if you are not fluent in typing symbols. Pay attention to how your fingers move here-this operator is everywhere in Go programs.

var count int = 10
message := "typed correctly"

Control structures

Go uses if, for, and switch statements. There is no while. The syntax is compact but requires careful typing of comparison operators ==, !=, <, > and the increment operator ++. Using = instead of == in a condition causes a compilation error.

for i := 0; i < 5; i++ {
 if i%2 == 0 {
 fmt.Println("even")
 }
}

Functions and multiple return values

Functions can return more than one value. That's a powerful feature, but it also means you will type commas inside return lists and assignments often. It's worth practicing until typing result, err := feels natural.

func divide(a, b int) (int, error) {
 if b == 0 {
 return 0, fmt.Errorf("division by zero")
 }
 return a/b, nil
}

result, err := divide(10, 2)

Slices, maps, and composite literals

Square brackets [] and braces {} appear constantly when you work with slices, arrays, and maps. Maps also use colons : to separate keys and values. Together these symbols form some of the trickiest lines to type cleanly if you're not yet comfortable with them.

nums := []int{1, 2, 3}
scores := map[string]int{"alice": 5, "bob": 7}

Structs and methods

Go's struct type groups data. Adding methods requires you to type parentheses for receivers and dots . for field or method access. Once you've done this enough, typing a method receiver feels as automatic as writing the word "func".

type User struct {
 Name string
}

func (u User) Greet() string {
 return "Hello " + u.Name
}

u := User{Name: "A"}
fmt.Println(u.Greet())

Interfaces

Interfaces in Go are satisfied implicitly, without explicit keywords like implements. Defining them means more braces and method signatures to type. It is a small amount of syntax, but it's worth learning to type fluently.

type Stringer interface {
 String() string
}

Concurrency and channels

One of the most distinctive features of Go is the channel operator <-. It doesn't exist in many other languages and it can feel clumsy at first. You will type it both ways: sending ch <- value and receiving value := <-ch. Training your fingers to type this operator smoothly will save you frustration.

ch := make(chan int)
go func() { ch <- 42 }()
value := <-ch

Strings and runes

Go uses double quotes for normal strings, backticks for raw strings, and single quotes for runes. It is easy to confuse them if you are typing quickly, but the compiler is strict. Be especially mindful when switching between ", `, and '.

text := "normal string"
raw := `path\to\file`
r := 'a'

Spacing and formatting

gofmt applies standard code formatting. You still need to respect Go's syntax rules for braces and line breaks. A common mistake is pressing Enter at the wrong spot, for example between return and its return value. Go inserts a semicolon at that line break, ending the return statement. Once you get used to its rules, your typing rhythm will become consistent with Go's formatting expectations.

Summary

Programming in Go requires attention to detail in typing. The characters that matter most are braces {}, parentheses (), brackets [], the short declaration operator :=, and the channel arrow <-. These symbols are everywhere in Go code. Practicing these characters is part of learning to type Go programs quickly and accurately.

Next text
Next lesson
Task Back to test
go
Chart Hide