Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Go (also called Golang) is a general-purpose, strongly typed, garbage-collected programming language designed with systems programming in mind. It has built-in support for concurrent programming and a package-and-module workflow that makes it suitable for command-line tools, network services, APIs and other production software. You can begin with a text editor and terminal on Linux, macOS or Windows.

This tutorial takes you from installation to a runnable module, then explains the concepts and official learning paths that should come next.

What Go is

The Go language specification describes Go as “a general-purpose language designed with systems programming in mind. It is strongly typed and garbage-collected and has explicit support for concurrent programming.” The Go authors’ current specification identifies language version go1.28, dated September 24, 2026; language and tool details can change, so check the current specification when maintaining a project.

What those terms mean

  • Strongly typed: values have defined types, and the compiler catches many invalid operations before the program runs.
  • Garbage-collected: the runtime automatically reclaims memory that is no longer reachable.
  • Concurrent: the language and standard library provide primitives for structuring work that can proceed independently, including goroutines and channels.
  • Systems-oriented: Go can produce compiled command-line programs and network services while still offering a comparatively small language and standard library.

Go is not a framework. It is the language, compiler, runtime, standard library and command-line toolchain used to build applications.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What you need before starting

  • A little programming experience helps, especially familiarity with functions, variables, conditionals and loops.
  • A text editor or IDE. The official tutorial names VS Code, GoLand and Vim as examples.
  • A terminal or command prompt. The documented workflow supports Linux, macOS and Windows.
  • The Go distribution installed from the official installation instructions. Use the current download for your operating system rather than relying on an old package cached by a third-party guide.

Install Go and verify it

  1. Open the current official Go installation page and install the package for your operating system.
  2. Open a new terminal so the installer’s PATH changes are loaded.
  3. Run go version. The command should print an installed Go version. If the command is not found, reopen the terminal and check that the Go binary directory is on PATH.

Keep one deliberate Go installation available to your shell. Multiple installations can make the compiler and editor report different versions.

Build your first Go module

1. Create a project directory

mkdir hello
cd hello

On Windows PowerShell, the same commands work in current versions. You can also create the folder through your file manager and change into it with cd.

2. Initialize a module

go mod init example.com/hello

Replace example.com/hello with the import path you intend to use if this will become a published project. The command creates go.mod, which records the module path and Go language/toolchain requirements.

3. Create main.go

package main

import "fmt"

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

An executable command uses package main and provides a main function. fmt is a standard-library package; its Println function writes a line to standard output.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

4. Run the program

go run .

The expected output is:

Hello, World!

go run . compiles the packages in the current module and runs the resulting program without leaving a separately installed executable in the project directory.

Packages, modules and the go command

Packages

A package is a group of Go source files in one directory that share a package declaration. Packages are the unit for organizing code and exposing identifiers to other code. A directory normally contains one package, apart from special test files.

Modules

A module is a related collection of packages described by a go.mod file. The module path gives imports a stable name, while the file records requirements used by the module. A single module can contain an executable package and several reusable library packages.

Useful tool commands

  • go run . compiles and runs the current package.
  • go build compiles packages and commands; for a command package it can produce an executable.
  • go test ./... runs tests in the current module and its subpackages.
  • go fmt ./... applies the standard source formatting.
  • go mod tidy adds requirements needed by imported packages and removes requirements no longer used.
  • go list ./... displays packages known to the module and is useful when diagnosing package layout.

Run go mod tidy after changing imports, especially before committing go.mod and go.sum.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Add a second package

Create a directory named greet and save this as greet/greet.go:

package greet

func Message() string {
    return "Hello from a package"
}

Change main.go to import the module path followed by the package directory:

package main

import (
    "fmt"
    "example.com/hello/greet"
)

func main() {
    fmt.Println(greet.Message())
}

If your module was initialized with a different path, use that exact path in the import. Then run:

go fmt ./...
go run .

This illustrates the relationship: greet is a package; the directory containing go.mod is the module that contains both packages.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Call code from an external module

The official beginner sequence next demonstrates finding a package and calling code maintained outside your module. The general workflow is:

  1. Import the external package in a Go source file.
  2. Run go mod tidy. The tool resolves the requirement and records it in go.mod, with checksums in go.sum when needed.
  3. Run or test the program.

Review a dependency’s documentation and source before adding it. A module requirement is executable code in your build, not merely a text snippet.

How Go handles concurrency

Go has explicit concurrency support, but concurrency does not automatically make every program faster. Use it when work can overlap, such as handling independent network requests. Start with clear ownership of data, keep shared mutable state small, and use synchronization or channels deliberately. Test concurrent code with the race detector when appropriate:

go test -race ./...

The Tour of Go introduces goroutines, channels and select alongside the language’s syntax, methods, interfaces and data structures.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A sensible learning path after Hello World

Use the Tour for interactive fundamentals

The Tour of Go is an interactive, browser-based introduction. It covers basic syntax and data structures, methods and interfaces, generics and concurrency primitives, and includes exercises. It is a good next step when you want to edit examples and see results rather than read prose only.

Choose a focused official tutorial

After the fundamentals, pick a task that matches your goal. The official tutorial directory includes material on:

  • modules and dependency workflows;
  • JSON encoding and decoding;
  • relational databases;
  • REST APIs;
  • generics;
  • fuzzing;
  • checking dependencies for known vulnerabilities.

These tutorials are more useful when you build a small project alongside them: for example, an HTTP service that accepts JSON, stores records and has tests.

Use a book or course only if its format helps you

The official learning directory lists The Go Programming Language by Alan A. A. Donovan and Brian W. Kernighan, as well as training providers such as Ardan Labs and Gopher Guides. They are optional; the official online material is sufficient to begin, and availability, editions and course terms can change.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Troubleshooting common first-project problems

go: command not found

The shell cannot find the Go executable. Reopen the terminal after installation, then inspect PATH. On Windows, start a new PowerShell or Command Prompt window.

go.mod file not found

You ran a module-aware command outside a module. Change into the directory containing go.mod, or initialize the project with go mod init.

Import path errors

The import must match the module path plus the package directory. Check the first line of go.mod, package spelling and directory names. Do not import a local package using an arbitrary filesystem path.

no required module provides package

The imported package is not recorded in the module requirements or the path is wrong. Correct the import, then run go mod tidy with network access.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

found packages ... and ... in the same directory

Go found source files declaring different packages in one directory. Move one group into a separate directory or make the declarations consistent. Test files can use the package name with an _test suffix, but ordinary source files cannot mix packages.

The program compiles but behaves incorrectly

Add focused tests, run go test ./..., format with go fmt ./..., and use the debugger or targeted logging. Compilation proves type and syntax checks passed; it does not prove the behavior is correct.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your Go project needs website screenshots for documentation, testing or an automation pipeline, ScreenshotNeo provides a website screenshot API and MCP server. A single request returns PNG, JPEG, WebP or PDF. Its cleaner capture accepts consent banners and removes more than 60 known consent platforms, newsletter popups and chat widgets before the shot; failed loads, bot checks or blank pages are not billed, and response headers identify the page verdict and billing result.

Use the API from a terminal:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Or call it from Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

See the ScreenshotNeo API documentation for options such as full-page capture, CSS selectors, device presets, custom JavaScript, waits, blocking rules, PDFs, caching and asynchronous jobs. Its MCP server exposes take_screenshot, get_page_info and capture_pdf to Claude, Cursor and other MCP clients. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Create a free ScreenshotNeo account.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What to build next

  • Turn the greeting into a command with flags and help text.
  • Add table-driven tests and run them with go test ./....
  • Build a small JSON or REST service using the focused official tutorials.
  • Measure and improve a real program before choosing concurrency or optimization techniques.

Frequently Asked Questions

Is Go the same as Golang?

Yes. Go is the language’s official name; “Golang” remains a common search and conversational term.

Do I need an IDE to learn Go?

No. A text editor and terminal are enough. VS Code, GoLand and Vim are examples of editors documented by the official tutorial.

Should I learn Go before using frameworks?

Learn the core language, packages, modules, testing and standard library first. That makes any later framework documentation easier to evaluate.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.