OneCompiler

Go

A complete, hands-on introduction to Go. Learn the basics, functions, slices, maps, strings, structs, interfaces, generics, errors and concurrency, with an exercise after every lesson.

11 sections·62 items·Beginner
This course includes
  • 62 practice problems
  • 62 lessons
  • Free — runs in your browser, no setup

What you'll learn

Write, compile and run Go programs
Use variables, types, operators, constants and formatted input and output
Control your program with if, switch and Go's for loop
Write functions with multiple returns, closures and defer
Work with arrays, slices, maps and strings
Build your own types with structs, methods, pointers and interfaces
Write generic functions and types
Handle errors the Go way and work with JSON
Run work at the same time with goroutines, channels and mutexes

Syllabus

About this course

Go is a programming language made at Google. It is used to build web servers, command-line tools and the software that runs large cloud systems. Docker and Kubernetes are written in Go. The language is small on purpose: it has few keywords and one kind of loop, so you can learn all of it and read other people's code with ease.

This course teaches Go from the first line. You start with fmt.Println and variables, then learn conditions, loops and functions. Next come slices, maps and strings, which you will use in almost every program and in coding interviews. After that you build your own types with structs, methods and interfaces, and write generic code. The last sections cover errors, JSON and concurrency with goroutines and channels, the feature Go is best known for. Each lesson is short and ends with an exercise. Almost every exercise is a program that you compile and run in the browser.

You don't need any programming experience. If you already know another language, the first sections will go quickly, and you will see where Go makes different choices.