← Back to Go Course | Chapter 1: Setup & Basics | Lesson 1 of 7

Introduction to Go

Go is a programming language made by Google to help people write clear, fast instructions for computers without a lot of confusing extra rules.

What is Go?

Go is an open-source, statically typed, compiled programming language designed at Google and released publicly in 2009. It combines the fast compilation and simplicity of a scripting language with the performance and safety of a compiled one.

Programs are compiled directly to machine code, so there is no separate virtual machine or interpreter needed at runtime.

Note: The official name is Go; Golang is just the nickname that stuck because go.dev was already taken as a domain search term.

Example: What is Go?

markup
// Every Go file belongs to a package; main builds an executable
package main

// Import the fmt package
import "fmt"

// main is where the program starts running
func main() {
	// Print the values followed by a newline
	fmt.Println("Go is a statically typed, compiled language")
}

Why Go Was Created

Go's creators were frustrated with slow builds, complex dependency management, and confusing language features in large C++ codebases.

They designed Go to compile quickly, have a small and readable syntax, and make concurrent programming (handling many tasks at once) simple and safe out of the box. The result is a language that is easy to learn but scales well to large teams and systems.

Note: Fast compile times were a founding goal -- large Go codebases at Google were taking too long to build in C++.

Example: Why Go Was Created

markup
// Every Go file belongs to a package; main builds an executable
package main

// Import the fmt package
import "fmt"

// main is where the program starts running
func main() {
	// Short declaration: create goals and infer the type
	goals := []string{"fast compilation", "simple syntax", "built-in concurrency"}
	// Loop over goals; the blank identifier _ ignores the index
	for _, g := range goals {
		// Print the values followed by a newline
		fmt.Println("Design goal:", g)
	}
}

Where Go Is Used

Go is popular for backend web servers, cloud and networking tools, and command-line utilities because of its speed, small memory footprint, and easy deployment (a single binary with no external runtime).

Companies like Google, Uber, and Cloudflare use Go for performance-critical services. Its built-in concurrency model also makes it a natural fit for systems that juggle many simultaneous network connections.

Note: Notable software written in Go includes Docker, Kubernetes, and Terraform.

Example: Where Go Is Used

markup
// Every Go file belongs to a package; main builds an executable
package main

// Import the fmt package
import "fmt"

// main is where the program starts running
func main() {
	// Short declaration: create usedFor and infer the type
	usedFor := map[string]string{
		"Docker":     "container tooling",
		"Kubernetes": "container orchestration",
		"Terraform":  "infrastructure as code",
	}
	// Loop over usedFor, getting each index and value
	for tool, purpose := range usedFor {
		// Print using a format string
		fmt.Printf("%s: %s\n", tool, purpose)
	}
}

Compiled, Not Interpreted

Unlike Python or JavaScript, Go source code is compiled ahead of time into a standalone native executable before it ever runs.

This means the compiler catches many mistakes (like type errors) before your program starts, and the resulting binary runs without needing Go installed on the machine that executes it. This trade-off costs a compile step but pays off in runtime speed and reliability.

Example: Compiled, Not Interpreted

markup
// Every Go file belongs to a package; main builds an executable
package main

// Import the fmt package
import "fmt"

// main is where the program starts running
func main() {
	// Print the values followed by a newline
	fmt.Println("This program is compiled into machine code before running")
	// Print the values followed by a newline
	fmt.Println("No interpreter is needed to execute the final binary")
}
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the view already swaps in the hi_ translation fields (or blanks these out if untranslated), so this renders correctly for both languages without a lang_code check here. #}
Common Mistakes
  1. Assuming Go is an interpreted scripting language like Python instead of a compiled, statically typed language.
  2. Confusing Go (the language, sometimes called Golang) with the unrelated board game or other Go products when searching for help online.
  3. Expecting classes and inheritance like Java/C++ instead of Go's simpler struct + interface composition model.
Chapter Summary
  • Go is a statically typed, compiled language created at Google in 2009 by Robert Griesemer, Rob Pike, and Ken Thompson.
  • It favors simplicity: a small keyword set, fast compilation, built-in concurrency, and automatic garbage collection.
  • Go compiles to a single native binary, making deployment straightforward across servers and containers.
  • It is widely used for backend services, cloud infrastructure (Docker, Kubernetes), and command-line tools.
🔒

Chapter Quiz — Complete all 7 topics to unlock

0/7 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.