Introduction to Go workspaces
One special thing about Go is what we call workspace.
The workspace is the “home base” for Go.
By default Go picks the $HOME/go
path, so you will see a go
folder in your home.
It’s first created when you install a package (as we’ll see later) but also to store some tooling. For example the moment I loaded the hello.go
file in VS Code, it prompted me to install the [gopls](https://pkg.go.dev/golang.org/x/tools/gopls)
command, the Delve debugger (dlv
) and the [staticcheck
linter](https://staticcheck.io/).
They were automatically installed under $HOME/go
:
When you will install packages using go install
, they will be stored here.
This is what we call GOPATH.
You can change the GOPATH
environment variable to change where Go should install packages.
This is useful when working on different projects at the same time and you want to isolate the libraries you use.
I wrote 21 books to help you become a better developer:
- HTML Handbook
- Next.js Pages Router Handbook
- Alpine.js Handbook
- HTMX Handbook
- TypeScript Handbook
- React Handbook
- SQL Handbook
- Git Cheat Sheet
- Laravel Handbook
- Express Handbook
- Swift Handbook
- Go Handbook
- PHP Handbook
- Python Handbook
- Linux Commands Handbook
- C Handbook
- JavaScript Handbook
- Svelte Handbook
- CSS Handbook
- Node.js Handbook
- Vue Handbook
Also, JOIN MY CODING BOOTCAMP, an amazing cohort course that will be a huge step up in your coding career - covering React, Next.js - next edition February 2025