Setting up Go (Golang) as a portable application on Windows allows you to develop and compile code from a USB drive or any folder without requiring administrative rights or a formal installation 1. Download the Portable Archive Instead of the standard installer, you must use the archive to ensure portability. official Go download page Locate the latest stable release for Windows (e.g., go1.x.x.windows-amd64.zip
go build -ldflags="-s -w" -o pingmon.exe golang portable windows
go build -ldflags="-s -w" -o tool.exe
set CGO_ENABLED=0 go build -o myapp.exe
go build -ldflags="-s -w" -o myapp.exe
Before we look at the how , let's look at the why . Most languages struggle with Windows portability: Setting up Go (Golang) as a portable application
Go has a rapid release cycle (roughly every six months). You might have a legacy project running on Go 1.18 and a new project on Go 1.21. Installing and uninstalling versions via MSI is tedious. A portable setup allows you to have go1.18 , go1.21 , and go1.22 sitting side-by-side in separate folders. Most languages struggle with Windows portability: Go has