Learn Go with AI · Free online book

Appendix A: Setting up your AI assistant

In short: Appendix A is the setup guide: installing the Go tools and putting them on your PATH, choosing an editor, installing an AI coding assistant (Claude Code in the examples) and making sure it reads your AGENTS.md rules. It also covers privacy settings and what not to give the AI.

This is the one part of the book that changes as tools change. The chapters stay the same; this appendix gets updated.

Last checked: November 2026, with Go 1.27.4, gopls v0.24.0, govulncheck v1.10.0 and Claude Code 2.1.331. Steps marked (Not tested for this edition) come from the tool’s official documentation but weren’t run on a real machine for this edition. If one doesn’t work for you, check the linked page: it will be more current than this book.

A.1 Install the Go tools

The book uses two tools that don’t come with Go. Install both with go install:

go install golang.org/x/tools/gopls@latest
go install golang.org/x/vuln/cmd/govulncheck@latest

Each may print a few go: downloading … lines, or nothing at all. No error means it worked.

Check that both run:

gopls version
govulncheck -version

gopls version prints a line like this:

golang.org/x/tools/gopls v0.24.0

Your version will be newer or the same; A.6 needs v0.20 or later. govulncheck -version prints the four lines shown in Chapter 6.

If you get command not found (macOS, Linux) or not recognized (Windows), see A.2.

A.2 Put Go’s bin folder on your PATH

go install puts programs in Go’s bin folder: ~/go/bin on macOS and Linux, and %USERPROFILE%\go\bin on Windows. Your terminal only finds programs in folders listed in your PATH.

Just for this terminal (macOS and Linux):

export PATH="$PATH:$(go env GOPATH)/bin"

Permanently, on macOS: the macOS installer adds Go itself to your PATH, but not its bin folder, so you’ll usually need this. macOS uses the zsh shell, so add the folder in ~/.zshrc:

echo 'export PATH="$PATH:$HOME/go/bin"' >> ~/.zshrc

Then open a new terminal. (~/go/bin is Go’s default bin folder.) (Not tested for this edition.)

Permanently, on Linux: most Linux systems use bash, so add the same folder in ~/.bashrc:

echo 'export PATH="$PATH:$HOME/go/bin"' >> ~/.bashrc

Then open a new terminal.

Windows: the Go installer usually adds %USERPROFILE%\go\bin to your PATH already, so you only need to open a new terminal after installing a tool. If the tool still isn’t found: open Settings → System → About → Advanced system settings → Environment Variables, select Path under your user variables, choose Edit → New, add %USERPROFILE%\go\bin, and open a new terminal. (Not tested for this edition.)

A.3 An editor

Any editor works. If you don’t have a favorite, use Visual Studio Code with the Go extension. (Not tested for this edition.)

  1. Install Visual Studio Code from code.visualstudio.com.
  2. Open the Extensions view, search for “Go”, and install the one from the Go Team at Google.
  3. Open your tracker folder (File → Open Folder) and open any .go file or go.mod. The Go version appears in the bottom-right corner. If VS Code offers to install missing tools, choose Install.
  4. A ⚡ next to the Go version means gopls is running.

A.4 Install Claude Code

Claude Code needs a paid Claude plan (Pro, Max, Ultra, Team or Enterprise) or a Claude Console account; the free claude.ai plan doesn’t include it. It runs on macOS 13 or later, Windows 10 (version 1809) or later, and recent Linux versions.

Install it with the command for your system (official instructions):

macOS, Linux:

curl -fsSL https://claude.ai/install.sh | bash

Windows PowerShell:

irm https://claude.ai/install.ps1 | iex

Windows Command Prompt:

curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd

The installer shows no progress while it downloads. If it ends with Setup notes saying ~/.local/bin is not in your PATH, add that folder the same way as Go’s bin folder in A.2. On macOS:

echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc

On Linux, use ~/.bashrc instead of ~/.zshrc. On Windows, the folder is %USERPROFILE%\.local\bin. Then open a new terminal and check:

claude --version
2.1.331 (Claude Code)

Your version will be newer or the same. If claude still isn’t found, see the installation troubleshooting page.

On Windows, installing Git for Windows is recommended. You need Git for the book anyway (Appendix B).

First run: in any terminal, type claude. It asks you to log in through your browser. Later, when you start it in your tracker folder (Chapter 1), it asks whether you trust the files in that folder. It’s your own project, so say yes. (Not tested for this edition.)

A.5 Make sure your assistant reads AGENTS.md

AGENTS.md is where you keep your project’s rules (Chapter 1). Many assistants read it automatically. Claude Code does from version 2.1.277; check yours with claude --version.

The following is from the Claude Code docs. (Not tested for this edition.)

Other assistants: look in your assistant’s documentation for its “project instructions” or “rules” file. If it doesn’t read AGENTS.md, point that file to AGENTS.md, or copy your rules into it.

A.6 Connect gopls to your assistant (optional)

gopls has an experimental MCP server. MCP is a standard way for AI assistants to use tools. Connected to gopls, your assistant can look up where a function is defined or used, instead of searching through whole files. It needs gopls v0.20 or later, which A.1 installed.

Claude Code: run this once, in any folder:

claude mcp add --scope user gopls -- gopls mcp

--scope user makes gopls available in every folder, so you can run it now, before your project exists. Check it with:

claude mcp list

It should show gopls: gopls mcp - ✔ Connected. If it says Executable not found in $PATH: "gopls", finish A.2 first.

Inside a Claude Code session, you can also type /mcp to see gopls and its tools. (Not tested for this edition.)

Other assistants: add an MCP server that runs the command gopls mcp. Your assistant’s documentation explains where; the gopls MCP page has examples for Gemini CLI and Claude Code.

This is optional. Everything in the book works without it.

A.7 Privacy settings

Every AI assistant has settings for what happens to your conversations. Check them before you start.

For Claude Code on a Pro, Max or Ultra plan, you choose whether your conversations may be used to improve future models, at claude.ai/settings/data-privacy-controls. You can change it at any time. On Team and Enterprise plans, Anthropic doesn’t train on your Claude Code data unless your organization opts in.

Claude Code also keeps session transcripts on your computer, in plain text under ~/.claude/projects/, for 30 days by default. That’s one more reason never to paste a secret into a chat. The data usage page has the details.

For other assistants, look for a privacy or data setting about “training” or “model improvement.”

A.8 What not to give the AI

The checklist from Chapter 1, to keep next to your keyboard:

If you wouldn’t post it on a public website, don’t give it to the AI.

A.9 Windows: sending JSON with curl

(Not tested for this edition.) Chapter 6 sends JSON to your API with curl. On Windows, type curl.exe, not curl: in Windows PowerShell, curl means a different command.

How to write the JSON depends on your terminal:

Not sure which PowerShell you have? Type $PSVersionTable.PSVersion.

A.10 Windows: a C compiler for go test -race

(Not tested for this edition.) Chapter 7’s race detector needs a C compiler on Windows: a MinGW-w64 GCC, recent enough to include version 8 or later of its runtime libraries. This works only on 64-bit Intel or AMD Windows. On Windows on Arm, -race isn’t available (race detector requirements).

One way to install a suitable GCC:

  1. Install MSYS2 from msys2.org.

  2. Open the MSYS2 UCRT64 terminal and run:

    pacman -S mingw-w64-ucrt-x86_64-gcc
  3. Add C:\msys64\ucrt64\bin to your user Path, the same way as in A.2.

  4. Open a new terminal.

Alternatively, download a UCRT build from winlibs.com, unzip it, and add its mingw64\bin folder to your Path. Avoid the old “MinGW” from mingw.org and old TDM-GCC builds; they’re too old.

Check it, in a new terminal:

gcc --version
gcc --print-file-name libsynchronization.a
go env CGO_ENABLED

The second command should print a full path to a file. If it just prints libsynchronization.a back, your GCC is too old. (This check is for Windows only. On Linux, GCC prints the name back even when it’s fine.) The last command should print 1.

On Linux, install GCC with your package manager, for example sudo apt install gcc (Debian, Ubuntu) or sudo dnf install gcc (Fedora). If you ever ran go env -w CGO_ENABLED=0, undo it with go env -u CGO_ENABLED. On macOS, you don’t need anything.