Go Overview

Go overview, major features, and supported environments

Go overview

Go is an open-source programming language announced by Google in 2009. It combines the benefits of statically typed languages with a concise development experience.

Before Go, Google commonly used languages such as C++ and Java for server software. Developers who prioritized convenience often chose dynamically typed interpreted languages such as Python and JavaScript. Go was created to provide efficient compilation and execution while keeping programs simple to write.

Go actively reduces unnecessary complexity. It does not need header files, and declarations are written once. It has no class hierarchy, exceptions, assertion statements, or overloading. Generics have been supported since Go 1.18.

Go is now widely used. Docker and Kubernetes are notable examples of software implemented in Go.

Major features

  • Formatting: Run gofmt or go fmt to format code automatically.
  • Comments: Use /* */ for block comments and // for line comments.
  • Naming: Package names are usually single lowercase words. Identifiers that start with an uppercase letter are exported outside the package.
  • Semicolons: Semicolons at the end of statements are usually omitted.
  • Control flow: := declares variables without an explicit type. Conditions for if and for do not need parentheses. Go uses for instead of separate while and do-while statements. A switch case does not need break by default.
  • Functions: Functions can return multiple values. A defer statement schedules cleanup work such as unlocking a mutex or closing a file.
  • Data: Use new for zero-valued storage and make for slices, maps, and channels. Constructor-style functions conventionally start with New.
  • Initialization: An init function can validate or prepare package state before the program starts.
  • Methods: Go has no classes, but methods can be defined on types by using receiver parameters.
  • Interfaces: Types satisfy interfaces implicitly. An interface parameter makes code less dependent on a concrete type.
  • Blank identifier: Use _ when a value intentionally does not need to be used.
  • Embedding: A struct can embed another struct or interfaces instead of using class inheritance.
  • Concurrency: Start asynchronous work with goroutines and communicate through channels. Use select to handle channel operations.
  • Errors: Functions commonly return an error value. panic and recover are available for exceptional situations.

Supported environments

The official download page provides installers and archives for operating system and architecture combinations. Support changes between Go releases, so check the Go downloads page and minimum requirements before installing.

OS Architectures Notes
Linux Various Go 1.24 and later require Linux kernel 3.2 or later.
macOS x86_64, ARM64 Go 1.26 requires macOS 12 Monterey or later.
Windows x86, x86_64, ARM64 Go 1.21 and later require Windows 10 or Windows Server 2016 or later.
Other operating systems Varies Check the official documentation for FreeBSD, OpenBSD, and other ports.

Go draws ideas from several language families:

  • C family for basic syntax
  • Pascal, Modula, and Oberon families for declarations and packages
  • Newsqueak and Limbo for concurrency

License

Go is distributed under a BSD-style license. Modification and distribution are allowed when the copyright and license notices are preserved and the lack of warranty is stated.

References