What Is New in Go 1.10
| Category | Key Changes |
|---|---|
| Build & Tooling | Build cache, test caching, parallel compilation, go test vet check integration |
| Language | No language changes |
| Core Library | New strings.Builder type, TLS 1.3 opt-in, improved time package, compiler improvements |
| Ports | New MIPS port, FreeBSD 10.3+ requirement |
How did Go 1.10 improve build performance?
Go 1.10 introduced a persistent build cache that dramatically speeds up repeated builds. The cache stores rebuild artifacts in a central location, eliminating redundant compilation work across different projects and directories.
This matters because it makes developer workflows significantly faster. You'll notice the biggest improvements when switching between branches or working on multiple modules that share dependencies.
The cache location defaults to the user's home directory but can be controlled with the GOCACHE environment variable. Running go clean -cache clears it when needed.
What testing improvements arrived in Go 1.10?
Test caching became available in Go 1.10, skipping test execution when the code and environment haven't changed. The go command automatically caches test results that pass, making test suites run much faster on subsequent runs.
Vet checks were integrated directly into go test, running automatically before tests. This ensures code quality checks become part of the standard testing workflow without extra steps.
You can disable test caching with go test -count=1 when you need fresh results. The system uses a similar cache mechanism to the build cache but stores test-specific results.
What new library features should developers know about?
The new strings.Builder type provides efficient string construction without the allocation overhead of repeated string concatenation. It's particularly useful for building large strings piece by piece.
Example usage:
var b strings.Builder
for i := 0; i < 10; i++ {
fmt.Fprintf(&b, "%d", i)
}
result := b.String()
The time package gained monotonic clock support, ensuring time measurements aren't affected by system clock adjustments. TLS 1.3 became available as an opt-in experimental feature through the tls.Config.MaxVersion setting.
How did the compiler and ports change in this release?
Parallel compilation became the default in Go 1.10, utilizing multiple cores during package compilation. This speeds up build times on modern multi-core machines without requiring any configuration.
A new MIPS port was added for the little-endian MIPS64 architecture (mips64le), expanding Go's hardware support. FreeBSD support now requires version 10.3 or later, dropping compatibility with older versions.
The compiler also improved escape analysis, resulting in better allocation decisions and reduced garbage collection pressure in some scenarios.
FAQ
Does the build cache work with vendor directories?
Yes, the build cache works seamlessly with vendor directories. The cache keys incorporate the content of vendor dependencies, so changes to vendored packages will properly invalidate the cache.
How do I disable the build cache completely?
Set GOCACHE=off in your environment. This returns to the pre-1.10 behavior where all builds start from scratch, though you'll lose the performance benefits.
Why are my tests sometimes skipped even when I change code?
Test caching considers more than just code changes - it also factors in environment variables, flags, and file content. Use go test -count=1 to force a fresh run when debugging test behavior.
When should I use strings.Builder instead of bytes.Buffer?
Use strings.Builder when you specifically need to build a string result. It's more efficient than bytes.Buffer for this purpose and provides a cleaner API with the String() method.
Is TLS 1.3 enabled by default in Go 1.10?
No, TLS 1.3 is experimental in Go 1.10 and must be explicitly enabled by setting MaxVersion: tls.VersionTLS13 in your TLS configuration. It became the default in later Go releases.