eng: the Microsoft infrastructure to build Go
July 15, 2026 ยท View on GitHub
This directory contains build infrastructure files that Microsoft uses to build Go. This directory serves a similar purpose to https://github.com/golang/build, which stores the build infrastructure for the upstream Go repo, https://go.googlesource.com/go.
The directory name, "eng", is short for "engineering".
Note
We use this name for historical reasons: the
dotnet/arcade auto-update process
specifically looked for eng/Version.Details.xml and eng/common/ absolute
paths. This caused us to decide to put various other infrastructure in eng,
too. The eng/pipeline directory now locks us in: we would need to
reconfigure every pipeline and move the yml files in every active branch in
order to move them.
The microsoft/go-infra repository also implements part of the infrastructure used to build Go, and more tools for project maintenance. For example, it implements code flow: updating the submodule to new Go commits.
Azure DevOps pipeline definitions and related pipeline documentation live in eng/pipeline.
Building Go
Prerequisites:
- Git
- PowerShell 6+
- Go install from source prerequisites
- Exception: this repository's build script automatically downloads a bootstrap version of Go.
In the root of the repository, run this command:
pwsh eng/run.ps1 build -refresh
-refreshrefreshes the Go submodule (updates it, cleans it, and applies patches) before the command builds the repository. Remove-refreshif you've made changes in the submodule (go) that you want to keep.- Add
-testto run tests after the build completes. - Add
-packbuildto create an archive file containing the Go build ineng/artifacts/bin. (A.tar.gzor.zipfile, depending on GOOS) - Add
-packsourceto create a.tar.gzfile containing the Go sources ineng/artifacts/bin.
Run this command for more information:
pwsh eng/run.ps1 build -h
Building upstream Go
The standard way to build the upstream Go repository is documented at
https://go.dev/doc/install/source: run
./make.bash in Go's src directory.
The eng/run.ps1 build script uses the same upstream scripts, but wraps them
and provides extra functionality. It automatically downloads a version of Go and
uses that to build, and also builds the race runtime once the standard build is
complete, to match the content of the official binary releases of Go.
Patch files
The Microsoft build of Go repository uses patch files to store changes to the go
submodule. The patch files are found in /patches.
We created the git-go-patch tool to develop and maintain the
patch files. We wrote this tool specifically for the Microsoft for Go developers project.
It's a Go program that can be invoked as git go-patch after it's installed. See
the git-go-patch readme for more information.
We also have some utilities in this repository to apply patches without
installing git-go-patch:
pwsh eng/run.ps1 submodule-refreshupdates the submodule and applies the patches.- Pass
-commitsto apply each patch as a separate commit.
- Pass
pwsh eng/run.ps1 build -refreshrefreshes the submodule and applies patches and then goes on to build the Microsoft build of Go.
The patch files are ordinary Git patches and can also be applied manually
without any custom tooling. Git commands like git am and git apply work directly. git format-patch produces the same
patch format as git-go-patch.
Editing the patch files by hand is not recommended. Use git-go-patch or manual
git patching commands to let Git handle the formatting and fine details.