thongtech/go-legacy-win7
Über uns
Go programming language with Windows 7/8/8.1, early Windows 10 and Server 2008 R2/2012/2012 R2/2016/2019 support, plus classic “go get” behaviour
Programmiersprachen und LaufzeitumgebungenGemessener Sternzuwachs
- in 24h
- 0
- in 7 days
- +4
- in 15 days
- +7
- in 1 month
- Aktualisierung verzögert
Nettoänderungen in überlappenden Zeiträumen, keine Tagessummen. Fehlende Messwerte bleiben leer. Sterne zeigen Interesse, nicht Qualität.
README.md
OriginalThe Go Programming Language
go-legacy-win7 is a fork of the Go programming language that maintains support for Windows 7, 8, 8.1, Server 2008 R2, Server 2012, and Server 2012 R2, and restores the deprecated go get behaviour. This project aims to provide a stable Go environment for users who need to support legacy Windows systems or prefer the traditional Go workflow.
Gopher image by Renee French, licensed under Creative Commons 4.0 Attribution licence.
Differences from Upstream Go
Windows 7/8/8.1, Early Windows 10 and Legacy Server Support
While the official Go project dropped support for Windows 7, 8, 8.1, Server 2008 R2, Server 2012, and Server 2012 R2 in Go 1.21, this fork maintains compatibility with all these legacy Windows systems.Early versions of Windows 10 get the same care. Upstream Go supports Windows 10 without naming a minimum release, but tests only on 22H2. Some earlier releases handle files and links more like Windows 7, 8 and 8.1, so we fix them the same way, and test each of our releases on the first Windows 10 (1507).
Tested on Windows 7 (build 7600) — no updates required — through Windows 11 26H2 (build 26300).
See the test results.Upstream Code First, Not a Blind Revert
Legacy support is not restored by reverting upstream changes or freezing old code. Upstream's current implementation is kept, with a fallback beneath it chosen at runtime by what the machine actually supports. Each fallback is built to reproduce upstream's behaviour as closely as the platform allows, so a program behaves the same whether it runs on Windows 7 or Windows 11, and current Windows is unaffected.Classic
go getBehaviour
This fork allows for the deprecatedgo getbehaviour whenGO111MODULEis set to "off" or "auto". This means:- In
GOPATH/src,go getandgo installcan operate inGOPATHmode. - Outside of
GOPATH/src, these commands can use module-aware mode when appropriate.
- In
Compatibility Notes
Please be aware that some newer Go features may not be fully compatible with legacy Windows systems. We try to maintain as much functionality as possible, but some limitations may exist. If you find one, please report it.
Changes in Each Release
Our current release includes the following modifications, with the
upstream changes each patch answers in the last column, and "Kernel" where a
quirk of Windows itself is the cause. Patches starting with T touch tests
only.
Loader and startup
| What it fixes | Patch | Upstream change |
|---|---|---|
Stock Go 1.27 programs do not start on Windows 7, 8 or 8.1, which refuse an executable stamped 10.0. We stamp 6.1 again, and syscall.GetVersion asks for the real version. |
0001 | 341b5e2 (Go 1.27) |
Programs fail at startup on Windows 7 without KB2533623, which adds the LOAD_LIBRARY_SEARCH_SYSTEM32 flag. Where the flag is refused, we load system DLLs by full path. |
0002 | a17d959 (Go 1.21) |
Programs fail at startup on Windows 7, which has no ProcessPrng. We use RtlGenRandom there. |
0003 | 693def1 (Go 1.22, and 1.21.5 by backport) |
Processes and consoles
| What it fixes | Patch | Upstream change |
|---|---|---|
Child processes cannot start from a Windows 7 console, the go command included. We restore Go 1.21's workaround for console handles in StartProcess. |
0004 | 2d76081 (Go 1.17) 48042aa (Go 1.22) |
CON, CONIN$ and CONOUT$ cannot be opened or stated on Windows 7, which knows only their bare names. We try the bare name when a \\.\ name is missing. |
0006 | 28b8851 (Go 1.23) bb0c14b (Go 1.25) |
Network and the poller
| What it fixes | Patch | Upstream change |
|---|---|---|
Sockets cannot be made on Windows 7 without Service Pack 1, which lacks WSA_FLAG_NO_HANDLE_INHERIT. We make them without the flag, then mark them not inheritable. |
0007 | 7c1157f (Go 1.22) |
Conn.File and Listener.File fail on Windows 7 and 8, which cannot take a socket off Go's I/O completion port. We leave the socket on the port. |
0008 | 6953ef8 (Go 1.25) 8a8f506 (Go 1.25) |
| A UDP read into a buffer too small for the waiting datagram hangs forever on Windows 7. We keep the completion notice for UDP sockets there. | 0009 | 932d0ae (Go 1.21) Kernel |
On Windows 7 and 8, the handle from os.File.Fd cannot be untied from Go's I/O completion port. We keep files and pipes off the port there, as Go 1.24 did. |
0010 | 8a8f506 (Go 1.25) d889729 (Go 1.28, and 1.26.9 and 1.27.2 by backport) |
| On Windows 8, a listener can stop accepting while the thread that asked is in a blocking read. We ask for every accept from a thread that never blocks. | 0022 | Connect #760161 (Windows 8) Kernel |
net.FileConn, net.FileListener and net.FilePacketConn fail now and then on every Windows, because temporary sockets are closed with CloseHandle. We close them with closesocket. Upstream's own fix, not backported to Go 1.27. |
0023 | 00be0f2 (Go 1.28) |
Files
Unless a row says otherwise, these apply on Windows 7, 8, 8.1 and some early versions of Windows 10.
| What it fixes | Patch | Upstream change |
|---|---|---|
Directories on FAT32, exFAT and network shares cannot be listed on Windows 7, which lacks the FileFullDirectoryRestartInfo format. We read them in the older format. |
0005 | be0b8e8 (Go 1.22) 2860e01 (Go 1.23) |
os.RemoveAll leaves read-only directories behind, because upstream's fallback clears the attribute through ReOpenFile, which fails on directories. We reopen the entry by name. |
0011 | 6d41809 (Go 1.25) b31dc77 (Go 1.26) |
The delete and os.Root fallbacks read attributes in one kernel query, instead of the four GetFileInformationByHandle makes. |
0012 | b31dc77 (Go 1.26) 59ea07b (Go 1.28, and 1.26.9 and 1.27.2 by backport) |
A file another program has open keeps its name after os.RemoveAll or os.Root deletes it, so its directory cannot be removed. We move such a file aside first. |
0013 | b31dc77 (Go 1.26) |
os.Remove leaves a file's name in place while another program has it open. It now deletes the way os.RemoveAll does. |
0014 | b31dc77 (Go 1.26) Kernel |
| Deleting a program right after it exits fails on Windows 8 and 8.1, which keep its file in use for some milliseconds. We retry the delete briefly. | 0015 | f0894a0 (Go 1.22) Kernel |
os.RemoveAll fails on a directory that still lists an entry whose last handle is closing. We wait briefly for the name to go. |
0016 | b31dc77 (Go 1.26) Kernel |
os.Root.Rename cannot replace a link to a directory or a file another program has open. We move the destination aside, rename, then delete it. |
0017 | 2ffda87 (Go 1.25) |
Links that lead to the wrong type, such as a junction to a file, open, where Windows 10 22H2 and 11 refuse them. syscall.Open now refuses them too. |
0018 | b19851b (Go 1.28, and 1.26.9 and 1.27.2 by backport) Kernel |
os.Chtimes through a junction to a file sets the file's times, where Windows 10 22H2 and 11 refuse it. Utimes now refuses it too. |
0019 | b19851b (Go 1.28, and 1.26.9 and 1.27.2 by backport) Kernel |
os.Stat of a junction to a file describes the file, where Windows 10 22H2 and 11 refuse it. os.Stat now refuses it too. |
0020 | b19851b (Go 1.28, and 1.26.9 and 1.27.2 by backport) Kernel |
Race detector
| What it fixes | Patch | Upstream change |
|---|---|---|
-race programs do not start on Windows 7, which lacks the DLL that provides WaitOnAddress. The race runtime now provides those functions itself. |
0021 | cc82867 (Go 1.21) c3bea70 (Go 1.19) |
The go command
| What it fixes | Patch | Upstream change |
|---|---|---|
GOPATH-mode go get no longer fetches and installs packages, because Go 1.22 removed it. We restore it from the code just before that removal. |
9999 | de4d503 (Go 1.22) |
Tests only
| What it fixes | Patch | Upstream change |
|---|---|---|
| A cgo callback test crashes on Windows 7 without Service Pack 1, which has AVX off. It now uses SSE2. | T0001 | 52fd498 (Go 1.27) |
| Two VHD tests fail where the Hyper-V PowerShell module is missing, as on Windows 7, 8 and 8.1. They now skip there. | T0002 | 7986e26 (Go 1.23) |
| A live TLS resumption test fails on an offline Windows 7, whose root store cannot verify the chain. It now skips there. | T0003 | b691a2e (Go 1.27, and 1.26.0 by backport) |
| System certificate tests fail on an offline Windows 7, whose root store lacks GTS Root R1. Those cases now skip there. | T0004 | bb8f9a6 (Go 1.21) |
Test Results
Every fallback is coupled with tests, and our toolchain passes Go's test suite, run in long mode, on each system below.
| System | Version | Toolchain | Go test suite |
|---|---|---|---|
| Windows 7 32-bit | 6.1.7600 | windows_386 |
✅ Passed |
| Windows 7 64-bit | 6.1.7600 | windows_amd64 |
✅ Passed |
| Windows 8 64-bit | 6.2.9200 | windows_amd64 |
✅ Passed |
| Windows 8.1 64-bit | 6.3.9600 | windows_amd64 |
✅ Passed |
| Windows 10 1507 32-bit | 10.0.10240 | windows_386 |
✅ Passed |
| Windows 10 64-bit | 10.0.19045 | windows_amd64 |
✅ Passed |
| Windows 11 64-bit | 10.0.26300 | windows_amd64 |
✅ Passed |
On Windows 10 22H2 and 11 our toolchain matches stock Go.
32-bit builds are tested only on Windows 7 and 10. They behave the same as their 64-bit siblings on the same kernel.
Download and Install
Binary Distributions
Release archives do not include the tests and scripts. Clone the repo if you want to run them.
Before you begin
To avoid PATH/GOROOT conflicts and mixed toolchains, uninstall any existing Go installation first.
Windows Installation
- Download the
go-legacy-win7-<version>.windows_<arch>.zipfile. - Extract the ZIP to
C:\(or any preferred location). This will create ago-legacy-win7folder. - Add the following to your system environment variables:
- Add
C:\go-legacy-win7\bin(or your chosen path) to the systemPATH. - Set
GOROOTtoC:\go-legacy-win7(or your chosen path).
- Add
- Add the following to your user environment variables:
- Add
%USERPROFILE%\go\binto the userPATH. - Set
GOPATHto%USERPROFILE%\go.
- Add
macOS and Linux Installation
Download the appropriate
go-legacy-win7-<version>.<os>_<arch>.tar.gzfile.- For macOS:
go-legacy-win7-<version>.darwin_<arch>.tar.gz - For Linux:
go-legacy-win7-<version>.linux_<arch>.tar.gz
- For macOS:
Extract the archive to
/usr/local:sudo tar -C /usr/local -xzf go-legacy-win7-<version>.<os>_<arch>.tar.gzAdd the following to your shell configuration file:
- For bash, add to
~/.bash_profileor~/.bashrc - For zsh, add to
~/.zshrc
export GOROOT=/usr/local/go-legacy-win7 export GOPATH=$HOME/go export PATH=$PATH:$GOROOT/bin:$GOPATH/bin- For bash, add to
Apply the changes:
- For bash:
source ~/.bash_profileorsource ~/.bashrc - For zsh:
source ~/.zshrc
Note:
- On macOS Catalina and later, zsh is the default shell.
- On most Linux distributions, bash is the default shell.
- For bash:
After installation, verify the installation by opening a new terminal and running:
go version
Install From Source
To install from source, please follow the steps on the official website.
FAQ
Is this official Go?
No. It is an independent fork. Bug reports for this fork belong here. Language and spec issues still belong with upstream Go.
Why not just use an old Go release?
Old releases miss years of fixes and language/runtime updates. This fork tracks current Go releases while retaining the legacy Windows and go get support.
Will you drop Windows 7 or raise system requirements?
No. Supporting Windows 7 and later is a standing promise. We aim to keep things working. We do not “fix” what is not broken.
What about security on legacy Windows?
Older Windows already has a large attack surface. Hardening individual legacy APIs here would not make those systems meaningfully safer. We prioritise stable behaviour instead, without weakening what upstream Go already guarantees. Prefer a Windows version Microsoft still supports when you can. This fork exists for cases where you cannot.
Is this safe to use on modern Windows?
Yes. We always prefer upstream's implementation and fall back only where the running system cannot provide it, so on current Windows you get exactly the APIs upstream Go uses. Neither side pays for the other. Legacy systems gain support they would otherwise not have, and modern systems give up nothing measurable in return.
Do I need a separate -race build?
No, not anymore. Our earlier releases split the build because -race binaries could not start on Windows 7. That gap is closed, so one build now covers every supported Windows version.
Can I mix this with an official Go install?
Avoid it. Uninstall other Go installs first (or keep isolated GOROOT/PATH) so tools do not pick the wrong binary.
Contributing
Feedback and issue reports are welcome, and we encourage you to open pull requests to contribute to the project. We appreciate your help!
Note that the Go project uses the issue tracker for bug reports and proposals only. See https://go.dev/wiki/Questions for a list of places to ask questions about the Go language.
Ähnliche Projekte entdecken
Wird geladen…