go

CLI Tool

golang/go

Open source programming language for building simple, reliable, and efficient software.

Overview

Go is a statically typed, compiled language created at Google. It features simplicity, strong concurrency support (goroutines, channels), and fast compilation. Its comprehensive standard library covers networking, cryptography, and web servers, making it ideal for modern cloud and system software.

README Preview

# The Go Programming Language\n\nGo is an open source programming language that makes it easy to build simple,\nreliable, and efficient software.\n\n\n*Gopher image by [Renee French][rf], licensed under [Creative Commons 4.0 Attribution license][cc4-by].*\n\nOur canonical Git repository is located at https://go.googlesource.com/go.\nThere is a mirror of the repository at https://github.com/golang/go.\n\nUnless otherwise noted, the Go source files are distributed under the\nBSD-style license found in the LICENSE file.\n\n### Download and Install\n\n#### Binary Distributions\n\nOfficial binary distributions are available at https://go.dev/dl/.\n\nAfter downloading a binary release, visit https://go.dev/doc/install\nfor installation instructions.\n\n#### Install From Source\n\nIf a binary distribution is not available for your combination of\noperating system and architecture, visit\nhttps://go.dev/doc/install/source\nfor source installation instructions.\n\n### Contributing\n\nGo is the work of thousands of contributors. We appreciate your help!\n\nTo contribute, please read the contribution guidelines at https://go.dev/doc/contribute.\n\nNote that the Go project uses the issue tracker for bug reports and\nproposals only. See https://go.dev/wiki/Questions for a list of\nplaces to ask questions about the Go language.\n\n[rf]: https://reneefrench.blogspot.com/\n[cc4-by]: https://creativecommons.org/licenses/by/4.0/\n

FAQ (5)

Troubleshooting
How to fix gopls panic in canRemoveParameter when using code actions?

This is a known bug in gopls v0.14.0: the 'remove unused parameter' refactoring (refactorRewrite) panics with a nil pointer dereference when a function parameter belongs to an external function that has no body, because canRemoveParameter calls go/ast.Inspect on a nil body. The fix was landed in CL 537878 and backported to the 0.14 release branch. To resolve it, upgrade gopls to v0.14.1 or later: go install golang.org/x/tools/gopls@latest, then restart your editor/language server.

GitHub Issue #63755
Troubleshooting
Why does windows.MemoryBasicInformation return wrong RegionSize, State, Protect, and Type values with VirtualQuery on windows/386?

MemoryBasicInformation in golang.org/x/sys/windows had the wrong struct layout on windows/386: an erroneous PartitionId field (added in CL 352249) shifted every field after AllocationProtect by 4 bytes, so VirtualQuery/VirtualQueryEx returned misaligned values and Type was never written. The fix is to upgrade golang.org/x/sys to a version containing CL 849405, which removes the PartitionId field on windows/386 so the struct matches the native 32-bit MEMORY_BASIC_INFORMATION ABI:

go get golang.org/x/sys@latest
go mod tidy

If your code references MemoryBasicInformation.PartitionId on 386, remove that usage after upgrading (it will no longer compile). Note the removal is intentionally source-breaking because preserving the incorrect layout would keep all subsequent fields at wrong offsets.

GitHub Issue #82008
Troubleshooting
Why does net.IPMask.MarshalText return empty output with no error in Go 1.28?

This is a bug in Go 1.28-devel when the new text marshaling format is enabled via GODEBUG=netmarshal=1. For an IPMask whose length is not 0, 4, or 16 bytes, MarshalText silently returns empty bytes with a nil error, destroying the data (e.g., json.Marshal produces "" and unmarshaling yields an empty mask). The cause is in src/net/ip.go, where addr, _ := netip.AddrFromSlice(m) discards the ok result, so the zero Addr produces empty output. Workarounds: (1) Disable the new format with GODEBUG=netmarshal=0 to fall back to the old base64 encoding, which round-trips any mask length correctly; (2) Only marshal masks of valid length (0, 4, or 16 bytes), e.g., validate with netip.AddrFromSlice and check the ok result before marshaling. The fix (returning a non-nil error for invalid mask lengths) is marked as a release blocker for Go 1.28.

GitHub Issue #81749
Troubleshooting
How to fix TestMulHighSVE SIGSEGV crash on linux/arm64 (SVE result vector overwrites adjacent stack slot)?

This is the SVE register-argument morestack spill-offset bug in cmd/compile, already fixed on Go master by CL 828585 (merged 2026-10-02). The crash is NOT caused by the arm64 memmove FP/SIMD change (CL 840906). It appeared on trybots because LUCI builds the patchset commit as uploaded, and every patchset of the CL was based on master from 2026-09-28 (a696473376), which predates the fix. Fix/workaround: rebase your CL onto current master (any commit after 2026-10-02) and re-upload so trybot runs include the compiler fix. Symptom confirmation: a spilled SVE (Z register) argument lands at the wrong stack offset during a morestack call, corrupting nearby slots (e.g. a closure pointer at sp+0x88 overwritten with MulHigh result lanes), causing faults like 'unexpected fault address 0xffffffbb00000777'.

GitHub Issue #82408
Troubleshooting
Why does json.Unmarshal fail with "invalid MAC address" after json.Marshal succeeds on net.HardwareAddr with GODEBUG=netmarshal=1?

This is a Go standard library bug (golang/go#82360). With GODEBUG=netmarshal=1, net.HardwareAddr.MarshalText uses HardwareAddr.String(), which hex-formats a byte slice of ANY length, but UnmarshalText uses ParseMAC, which only accepts 6, 8, or 20 byte addresses. So a HardwareAddr like {0x01, 0x02, 0x03} marshals to "01:02:03" but fails to unmarshal with address 01:02:03: invalid MAC address. Fixes/workarounds: (1) Upgrade to a Go version containing CL 851265 (net: marshal and unmarshal invalid HardwareAddr values), which makes marshal/unmarshal handle invalid lengths; (2) Remove GODEBUG=netmarshal=1 to revert to the old base64 JSON encoding, which round-trips for any slice length; (3) Only use standard MAC lengths (6, 8, or 20 bytes) if you need the text marshaling behavior.

GitHub Issue #82360