1. Home
  2. /
  3. Go
  4. /
  5. Level Tracker

Level Tracker - Go Typing CST Test

Loading…

Level Tracker — Go Code

Tracks game levels using goroutines safely.

package main

import (
	"fmt"
	"sync"
)

func main() {
	level := 1
	var mu sync.Mutex
	var wg sync.WaitGroup

	nextLevel := func() {
		mu.Lock()
		level++
		fmt.Println("Level:", level)
		mu.Unlock()
	}

	wg.Add(2)
	go func() { defer wg.Done(); nextLevel() }()
	go func() { defer wg.Done(); nextLevel() }()

	wg.Wait()
}

Go Language Guide

Go (Golang) is a statically typed, compiled programming language designed at Google. It emphasizes simplicity, concurrency, and high-performance networking and system programming, making it ideal for cloud services, web backends, and distributed systems.

Primary Use Cases

  • ▸Backend web services and APIs
  • ▸Cloud-native and distributed systems
  • ▸Command-line utilities
  • ▸Network programming and microservices
  • ▸DevOps and infrastructure tooling

Notable Features

  • ▸Compiled and statically typed with fast binaries
  • ▸Goroutines and channels for concurrency
  • ▸Automatic memory management via garbage collection
  • ▸Powerful standard library, especially for networking and web
  • ▸Cross-platform compilation support

Origin & Creator

Created by Robert Griesemer, Rob Pike, and Ken Thompson at Google in 2007 and publicly released in 2009.

Industrial Note

Go is specialized for backend systems, cloud infrastructure, networking, and concurrent applications rather than heavy GUI or mobile frontend development.

More Go Typing Exercises

Go Counter with GoroutinesGo Theme ToggleGo Score TrackerGo Simple TimerGo Health TrackerGo Coin CounterGo Ammo TrackerGo Star Collector

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher