Skip to content

Instantly share code, notes, and snippets.

@fillest
Last active February 12, 2024 13:29
Show Gist options
  • Save fillest/06e3efc7c018fbab808090a0c2e16f08 to your computer and use it in GitHub Desktop.
Save fillest/06e3efc7c018fbab808090a0c2e16f08 to your computer and use it in GitHub Desktop.
  • each iteration of the loop creates new variables
  • Enhanced HTTP routing patterns (breaks backwards compatibility in small ways)
  • go/types - new Alias type - may break existing type switches that do not know to check for them
  • for i := range 10 //from 0 to 9, inclusive
  • New math/rand/v2 package
  • Commands in workspaces can now use a vendor directory containing the dependencies of the workspace
  • runtime/trace - trace viewer improved, execution tracer has been completely overhauled
  • runtime/pprof Mutex profiles improved
  • PGO improvement
  • some new runtime/metrics
  • cmp.Or()
  • slices.Concat()
  • functions min and max
  • function clear deletes all elements from a map or zeroes all elements of a slice
  • Multiple improvements that increase the power and precision of type inference
  • includes a preview of a language change we are considering for a future version of Go: making for loop variables per-iteration instead of per-loop, to avoid accidental sharing bugs. For details about how to try that language change, see the LoopvarExperiment wiki page.
  • formalizes Go's use of the GODEBUG
  • On Linux platforms that support transparent huge pages, the Go runtime now manages which parts of the heap may be backed by huge pages more explicitly.
  • As a result of runtime-internal garbage collection tuning, applications may see up to a 40% reduction in application tail latency and a small decrease in memory use. Some applications may also observe a small loss in throughput. The memory use decrease should be proportional to the loss in throughput, such that the previous release's throughput/memory tradeoff may be recovered (with little change to latency) by increasing GOGC and/or GOMEMLIMIT slightly.
  • Profile-guide optimization (PGO) .. is now ready for general use
  • new log/slog package provides structured logging with levels. https://go.dev/blog/slog
  • new slices package provides many common operations on slices
  • new maps package provides several common operations on maps
  • sync - OnceFunc, OnceValue, and OnceValues
  • new cmp package defines the type constraint Ordered and two new generic functions Less and Compare that are useful with ordered types.
  • runtime/trace - Collecting traces on amd64 and arm64 now incurs a substantially smaller CPU cost: up to a 10x improvement. Traces now contain explicit stop-the-world events for every reason
  • context WithDeadlineCause, WithTimeoutCause, AfterFunc
  • Textual stack traces produced by Go programs, such as those produced when crashing, calling runtime.Stack, or collecting a goroutine profile with debug=2, now include the IDs of the goroutines that created each goroutine in the stack trace.
  • A few previously-internal GC metrics, such as live heap size, are now available
  • The go test command now accepts -skip to skip tests, subtests, or examples matching .
  • When the main module is located within GOPATH/src, go install no longer installs libraries for non-main packages to GOPATH/pkg, and go list no longer reports a Target field for such packages.
  • The go build, go install, and other build-related commands now support a -cover flag that builds the specified target with code coverage instrumentation.
  • The go command now disables cgo by default on systems without a C toolchain.
    • when Go is installed on a system without a C compiler, it will now use pure Go builds for packages in the standard library that use cgo. The packages in the standard library that use cgo are net, os/user, and plugin
  • expands support for error wrapping to permit an error to wrap multiple other errors.
  • The math/rand package now automatically seeds the global random number generator (used by top-level functions like Float64 and Int) with a random value, and the top-level Seed function has been deprecated
  • sync - The new Map methods Swap, CompareAndSwap, and CompareAndDelete allow existing map entries to be updated atomically.
  • time
    • The new time layout constants DateTime DateOnly, and TimeOnly provide names for three of the most common layout strings used in a survey of public Go source code.
    • The new Time.Compare method compares two times.
  • context.WithCancelCause
  • types.Satisfies()
  • DNS resolution will detect changes to /etc/nsswitch.conf and reload the file when it changes.
  • runtime/metrics - adds new supported metrics, including the current GOMAXPROCS setting (/sched/gomaxprocs:threads), the number of cgo calls executed (/cgo/go-to-c-calls:calls), total mutex block time (/sync/mutex/wait/total:seconds), and various measures of time spent in garbage collection.
  • The go build, go install, and other build-related commands now support a -pgo flag that enables profile-guided optimization
    • profile-guided optimization is a preview, so please use it with appropriate caution
  • runtime/pprof Stop-the-world pause times have been significantly reduced when collecting goroutine profiles
  • support for a soft memory limit, GC guide
  • The pure Go resolver will now use EDNS(0)
  • When a net package function or method returns an "I/O timeout" error, the error will now satisfy errors.Is(err, context.DeadlineExceeded)
  • atomic improvements?
  • Generics
  • GOAMD64 (optimization, processor features)
  • fuzzing
  • changes to go get, go.mod and go.sum flows, go mod download
  • go version, debug/buildinfo
  • Workspaces, go work
  • net/netip
  • TLS 1.0 and 1.1 disabled by default client-side
  • Pruned module graphs
  • some vendor changes
  • go run now accepts arguments with version suffixes
  • new Time.UnixMilli and Time.UnixMicro
  • (perf optim) Go 1.17 implements a new way of passing function arguments and results using registers instead of the stack
  • The format of stack traces from the runtime .. is improved
  • The math package now defines three more constants: MaxUint, MaxInt and MinInt
  • On Unix systems, the table of MIME types is now read from the local system's Shared MIME-info Database when available.
  • https://go.dev/ref/spec#Conversions_from_slice_to_array_pointer
  • Module-aware mode is enabled by default, regardless of whether a go.mod file is present
  • go install now accepts arguments with version suffixes
  • go install .. is now the recommended way to build and install packages in module mode
  • Deprecation of io/ioutil
  • embedding files as part of the final executable
  • runtime/metrics
  • the runtime now defaults to releasing memory to the operating system promptly (using MADV_DONTNEED)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment