Skip to content

Go Release Notes

Maintenance Versions:

  • go1.25, first release: 2025-08-12, last update: go1.25.0 (2025-08-12)
  • go1.24, first release: 2025-02-11, last update: go1.24.6 (2024-08-06)

Go official release notes: Release History - The Go Programming Language

Go official uses semantic versioning for version identification, format is vMAJOR.MINOR.PATCH (see Semantic Versioning), MAJOR version update means Breaking Change occurred, i.e., updates that are not backward compatible, MINOR version update means new features added while maintaining backward compatibility, PATCH version update means problems fixed while maintaining backward compatibility.

Go team releases a MINOR version every six months, and only the latest two MINOR versions are long-term maintained, maintenance time is six months each. Given that Go maintains quite high compatibility with every update, it is recommended to upgrade Go to the latest version in time after the new version is stable.

The last time Go 2.0 proposed a draft was on November 19, 2018, when it was still at go1.13 version. Five years later, the version has iterated to go1.21. Various ideas of Go 2.0 have been reflected in Go 1.0 through incremental updates. One of the founders also explicitly stated that there may not be Go 2.0 in the future, and Go will continue to strive to maintain backward compatibility (see Go 1 and Future of Go Programs).

Tip

This page is just a simple repost of the official log, not updated regularly. To get the latest news, please go to the official website.

1.25

First release: 2025-08-12

Last update: go1.25.0 (2025-08-12)

For detailed release notes of go1.25 version, go to Go 1.24 Release Notes to view. For all patch versions released during its maintenance period, go to Go1.25 - Release Patch to learn.

Language Level

  1. Removed the concept of core type in generics (core type), see official blog post Goodbye core types

Standard Library

  1. Added test/synctest for testing concurrent code
  2. Added experimental library encoding/json/v2, which includes:
    • encoding/json/v2, deserialization speed is about 2-10 times faster than v1, see benchmark go-json-experiment/jsonbench
    • encoding/json/jsontext, provides low-level interaction capability with json strings

Toolchain

  1. Subsequent Go releases will include a small number of pre-built binary tools
  2. go mod added ignore directive to specify folders that go command should ignore
  3. go doc -http can start a local http server to view code documentation
  4. go vet added waitgroup and hostport analyzers
  5. When go command updates go version in go.mod or go.work, it no longer adds specified go toolchain version

Runtime

  1. GOMAXPROCS will perceive container CPU limits in container environments

  2. New experimental GC greenteagc, GC's basic scheduling unit changed from object to memory span

  3. When panic is not caught, it no longer prints repeatedly

    panic: PANIC [recovered]
      panic: PANIC

    changes to

    panic: PANIC [recovered, repanicked]
  4. Added runtime/trace.FlightRecorder, capable of continuously capturing runtime execution information in a lighter way

Compiler

  1. Fixed the bug of 1.21 null pointer delayed check (delayed until after error check), the following code that has obvious problems at first glance could run normally before version 1.25

    go
    package main
    
    import "os"
    
    func main() {
    	f, err := os.Open("nonExistentFile")
    	name := f.Name()
    	if err != nil {
    		println("should panic") // This line will be output before 1.25
    		return
    	}
    	println(name)
    }
  2. Compiler will reserve more backing memory for slices on the stack to improve usage performance

  3. Support generating DWARF5 debug information

1.24

First release: 2025-02-11

Last update: go1.24.6 (2025-08-06)

For detailed release notes of go1.24 version, go to Go 1.24 Release Notes to view. For all patch versions released during its maintenance period, go to Go1.24 - Release Patch to learn.

Language Level

  1. Generic type aliases, allowing creating aliases for generic types, which is very useful when referencing third-party defined generic types, for example

    go
    import (
        "other"
    )
    
    type MyQueue[T any] = other.Queue[T]

Standard Library

  1. Added weak package: provides weak pointers (Weak Pointers), allowing objects to be referenced without increasing reference count, avoiding memory leaks caused by caching. Need to check if pointer is nil before use
  2. File system access restrictions: introduced os.Root type to limit file operations within specific directories, enhancing security
  3. Encryption and hash support: added crypto/mlkem, crypto/hkdf, crypto/pbkdf2 and crypto/sha3 packages, optimized performance of existing encryption algorithms
  4. Added benchmark testing function testing.B.Loop for better loop testing
  5. encoding/json: added omitzero tag, supports zero value filtering based on IsZero() method
  6. strings and bytes: added iterator functions (such as Lines, SplitSeq, FieldsSeq)

Runtime

  1. Rebuilt built-in map based on Swiss Tables, large map access speed improved by 30%, iteration speed improved by 10%-60%
  2. sync.Map changed to use concurrent hash trie (hash-trie) to optimize performance, especially in concurrent write scenarios
  3. Runtime internal mutexes use new spinbit implementation, reducing lock contention and improving performance in high concurrency scenarios
  4. Optimized small object allocation strategy, reducing memory fragmentation and GC pause time
  5. Added runtime.AddCleanup to replace runtime.SetFinalizer, supporting registering multiple cleanup functions for objects and executing them sequentially in independent goroutines

Cgo

  1. Support #cgo noescape and #cgo nocallback annotations, declaring C functions do not escape memory and do not callback Go functions respectively, improving runtime performance
  2. Cgo now refuses to compile calls to C functions with multiple incompatible declarations, strictly detecting incompatible C function declarations across files (such as void f(int) and void f(double)), avoiding generating incorrect call sequences

工具链

  1. Module tool dependency management: track tool dependencies through go.mod's tool directive, replacing traditional tools.go empty import scheme
  2. Structured output: go build and go test support -json flag, output JSON format build and test results
  3. Compilation and linking optimization: compiler generated code efficiency improved, linker by default generates GNU Build ID (ELF platform) and UUID (macOS)
  4. Prohibit bypassing method definition restrictions for CGO generated types through aliases
  5. go build automatically embeds version control system information into binary files (support -buildvcs=false to disable)
  6. GOAUTH environment variable supports private module authentication.
  7. go.mod supports tool directive to manage executable dependencies, replacing tools.go empty white import
  8. Added go get -tool parameter and go install tool command to manage module tool dependencies
  9. Build cache supports binary caching for go run and go tool
  10. objdump supports LoongArch, RISC-V, S390X disassembly
  11. vet added tests analyzer (detects test function signature errors)

Platform Compatibility

  1. macOS: Go 1.24 is the last version to support macOS 11 Big Sur, Go 1.25 will require macOS 12+
  2. Windows: marked 32-bit ARM architecture as incomplete (GOOS=windows GOARCH=arm), see issue #70705
  3. Linux: minimum kernel version requirement upgraded to 3.2
  4. Requires Go 1.22.6+ as bootstrap toolchain

Deprecated

  1. math/rand.Seed() completely invalid, need to restore old behavior through GODEBUG=randseednop=0.
  2. runtime.GOROOT() marked as deprecated, recommended to get path through go env GOROOT

1.23

First release: 2024-08-13

Last update: go1.23.4 (2024-12-03)

For detailed release notes of go1.23 version, go to Go 1.23 Release Notes to view. For all patch versions released during its maintenance period, go to Go1.23 - Release Patch to learn.

Language Level

  1. for range supports iterator functions, for detailed information see Go Wiki: Rangefunc Experiment.

    go
    func Upper(s []string) iter.Seq2[int, string] {
      return func(yield func(int, string) bool) {
        for i, s1 := range s {
          if !yield(i, strings.ToUpper(s1)) {
            return
          }
        }
        return
      }
    }
    
    func main() {
      sl := []string{"hello", "world", "golang"}
      for i, s := range Upper(sl) {
        fmt.Printf("%d : %s\n", i, s)
      }
    }
    
    //0 : HELLO
    //1 : WORLD
    //2 : GOLANG

    This is a relatively practical feature, generally used in combination with generics.

Standard Library

  1. Added standard library iter, which defines and describes detailed information about iterators

  2. maps library added several iterator functions

  3. slices library added several iterator functions

  4. Added structs library, providing ability to modify struct attributes, such as memory layout

    go
    type Person struct {
      Name string
      Age  int
      _    structs.HostLayout
    }
  5. Optimized implementation of time standard library

Linker

  1. Handle abuse of //go:linkname, for some frequently referenced APIs temporarily allow their existence, such as runtime.memhash64, runtime.nanotime, etc. After this, other new references will not be allowed.

    go
    //go:linkname gcinit runtime.gcinit
    func gcinit()
    
    func main() {
      gcinit()
    }

    Code like this cannot pass compilation

    link: main: invalid reference to runtime.gcinit

Toolchain

  1. Added go telemetry command for telemetry data management

1.22

First release: 2024-02-06

Last update: go1.22.6 (released 2024-08-06)

For detailed release notes of go1.22 version, go to Go 1.22 Release Notes to view. For all patch versions released during its maintenance period, go to Go1.22 - Release Patch to learn.

Language Level

  1. Solved the go language loop variable problem

    go
    func main() {
      var wg sync.WaitGroup
      const n = 10
      wg.Add(n)
      for i := 0; i < n; i++ {
        go func() {
          fmt.Println(i)
          wg.Done()
        }()
      }
      wg.Wait()
    }

    This code will output 10 9s before 1.22, and will normally output 0 to 9 after 1.22.

  2. for range now supports iterating numeric types, as follows

    go
    for i := range 10 {
      fmt.Println(i)
    }

Standard Library

  1. Enhanced routing of net/http standard library

  2. database/sql added sql.Null generic type

    go
    type Null[T any] struct {
      V     T
      Valid bool
    }

    Usage as follows

    go
    type Person struct {
      Name sql.Null[string]
      Age  sql.Null[int]
    }

1.21

First release: 2023-08-08

Last update: go1.21.13 (released 2024-08-06)

For detailed release notes of go1.21 version, go to Go 1.21 Release Notes to view. For all patch versions released during its maintenance period, go to Go1.21 - Release Patch to learn.

Language Level

  1. Added two built-in functions min, max, for calculating maximum and minimum values.

  2. Added built-in function clear, for clearing map and slice

  3. Updated package initialization order

    • Sort all packages by import path
    • Repeat execution until the package list is empty
    • Find the first package in the list where all imports have been initialized
    • Initialize that package and remove it from the list
  4. Improved and enhanced type inference ability and precision, mainly generics related.

  5. Released preview version of for range loop variable improvement, this is a problem that has plagued Go developers for nearly ten years, the official finally solved it, details see: LoopvarExperiment · golang/go Wiki (github.com) and Proposal: Less Error-Prone Loop Variable Scoping (googlesource.com)

  6. Guaranteed that recover's return value will not be nil, if parameter is nil when calling panic, it will trigger another panic, returning *runtime.PanicNilError. For compatibility, setting GODEBUG=panicnil=1 at compile time allows passing nil to panic.

Standard Library

  1. Added log/slog library, providing standard structured logging library
  2. Added testing/slogtest library, for verifying slog.Handler implementation
  3. Added slices library, providing a series of generic functions for operating slices.
  4. Added maps library, providing a series of generic functions for operating map
  5. Added cmp library, for comparing ordered types.

Other

  1. go1.21.0 at least requires win10 or Windows Server 2016 version or above to run on windows system, previous versions are no longer supported.
  2. go1.21.0 at least requires macOS 10.15 Catalina or newer version to run, previous versions are no longer supported.
  3. Added experimental WebAssembly System Interface, Go is still constantly exploring in WASM.
  4. In 1.20 it was still experimental (Profile-guided optimization) PGO (see Profile-guided optimization - The Go Programming Language), 1.21 version officially enabled it. Including default.pgo file in main package will enable this feature, after enabling performance may improve by 2%-7%.
  5. When printing very deep runtime call stacks, changed from originally printing only the first hundred frames to now printing the first 50 and the last 50 frames respectively.
  6. Optimized CGO call performance on Unix platform, optimized from 1-3 microseconds to now 100-200 nanoseconds.
  7. In 1.21 version, compilation speed improved by nearly 6%, this is mainly attributed to the compiler itself being built using PGO.

1.20

First release: 2023-02-01

Last update: go1.20.14 (released 2024-02-06)

For detailed release notes of go1.20 version, go to Go 1.20 Release Notes to view. For all patch versions released during its maintenance period, go to Go1.20 - Release Patch to learn.

Language Level

  1. When converting slice type to array, originally needed to dereference pointer array *(*[4]byte)(x) to avoid operating same underlying array with slice, now can write directly like [4]byte(x).
  2. unsafe added SliceData, String, StringData functions, for building and structuring slice and string values.

Standard Library

  1. Added crypto/ecdh library, providing support for ECDH (Elliptic Curve Diffie-Hellman, a non-symmetric encryption method).
  2. go1.20 extended support for error wrapping, allowing one error to wrap multiple errors.
  3. Added net/http.ResponseController, providing a clearer, more discoverable way to add per-handler controls.
  4. httputil.ReverseProxy includes a new Rewrite Hook function, replacing the previous Director Hook.

Other

  1. go1.20 is the last version to support win7, 8, Server2008 and Server2012, future versions will no longer provide support.
  2. go1.20 is the last version to support macOS 10.13 or 10.14, future versions will no longer provide support.
  3. In 1.18 and 1.19 versions, due to appearance of generics, compared to 1.17 compilation speed appeared regression, go1.20 compilation speed will improve by about 10%.
  4. Released preview version of PGO (Profile-guided optimization), this is a compiler optimization technology in computer field, can improve runtime performance.
  5. In go1.20, on systems without C toolchains, go command disables cgo.
  6. Support collecting program code coverage files, see Coverage profiling support for integration tests - The Go Programming Language
  7. Made improvements to GC, improved stability, reduced memory overhead, improved overall 2% CPU performance.

1.19

First release: 2022-08-02

Last update: go1.19.13 (released 2023-09-06)

For detailed release notes of go1.19 version, go to Go 1.19 Release Notes to view. For all patch versions released during its maintenance period, go to Go1.19 - Release Patch to learn.

Important Changes

  1. Memory model aligns with c/c++, similar to TcMollcate

  2. sync/atomic package now provides more types available for use

  3. Support using runtime/debug.SetMemoryLimit function to perform soft limit on go memory, in some cases can improve memory utilization efficiency

  4. Runtime will now choose an appropriate size to initialize stack space memory based on average usage of goroutine stack, this can avoid frequent stack expansion and contraction

1.18

First release: 2022-03-15

Last update: go1.18.10 (released 2023-01-10)

For detailed release notes of go1.18 version, go to Go 1.18 Release Notes to view. For all patch versions released during its maintenance period, go to Go1.18 - Release Patch to learn.

Language Level

  1. Heavyweight update, supports generics, type set interfaces, parameter type constraints

Other

  1. Optimized append function's expansion behavior
  2. Added debug/buildinfo package, can get go program's build information at runtime
  3. gofmt can now format source files concurrently

1.17

First release: 2021-08-16

Last update: go1.17.13 (released 2022-08-01)

For detailed release notes of go1.17 version, go to Go 1.17 Release Notes to view. For all patch versions released during its maintenance period, go to Go1.17 - Release Patch to learn.

Language Level

  1. Added unsafe.Add function, supports pointer arithmetic
  2. Added unsafe.Slice function, supports getting pointer of slice's underlying array
  3. Slice can now be converted to array pointer type, []T => *[N]T, provided that array length is less than or equal to slice length

1.16

First release: 2021-02-16

Last update: go1.16.15 (released 2022-03-03)

For detailed release notes of go1.16 version, go to Go 1.16 Release Notes to view. For all patch versions released during its maintenance period, go to Go1.16 - Release Patch to learn.

Important Changes

This version has no important syntax changes, some important changes are as follows

  1. Deprecated ioutil package
  2. Support embedding some static files into program through //go:embed directive
  3. Added io/fs.Fs type, better abstraction for file system

1.15

First release: 2020-08-11

Last update: go1.15.15 (released 2021-08-05)

For detailed release notes of go1.15 version, go to Go 1.15 Release Notes to view. For all patch versions released during its maintenance period, go to Go1.15 - Release Patch to learn.

Important Changes

This version has no important syntax changes, some important changes are as follows

  1. Optimized small object allocation efficiency

  2. Added package time/tzdata, supports embedding timezone database into program through following way, because many systems locally do not have timezone data information.

    go
    import _ "time/tzdata"
  3. Made major improvements to go linker, reduced its resource usage and improved code robustness

  4. In some cases, allow unsafe.Pointer to convert to uintptr

1.14

First release: 2020-02-25

Last update: go1.14.15 (released 2021-02-04)

For detailed release notes of go1.14 version, go to Go 1.14 Release Notes to view. For all patch versions released during its maintenance period, go to Go1.14 - Release Patch to learn.

Language Level

  1. Support method set interface type nesting

    go
    type MyIO interface {
      io.WriteCloser
    }

Other

  1. Introduced open coding optimization, defer call overhead reduced to almost same as native call
  2. Support asynchronous preemption between goroutines, loops without function calls will no longer permanently block scheduling

1.13

First release: 2019-09-03

Last update: go1.13.15 (released 2020-08-06)

For detailed release notes of go1.13 version, go to Go 1.13 Release Notes to view. For all patch versions released during its maintenance period, go to Go1.13 - Release Patch to learn.

Language Level

  1. Support more modern numeric literals, such as

    go
    0b101 // binary
    0o10 // octal
    0x1B // hexadecimal

    Support underscore separation of numbers to bring better readability

    go
    10_000

    Imaginary number i suffix can now be any binary, octal, hexadecimal, or floating point number

Other

  1. GO111MODULE value defaults to auto
  2. Added GOPRIVATE environment variable to support private dependency sources
  3. Added GOSUMDB environment variable
  4. defer usage overhead reduced by 30%
  5. When index out of bounds occurs, panic now prints index information
  6. Go performs semantic version verification when downloading dependencies

1.12

首次发布:2019-02-25

最后更新:go1.12.17 (released 2020-02-12)

go1.12 版本的详细更新日志可以前往Go 1.12 Release Notes查看,在其维护期间发布的所有补丁版本可以前往Go1.12 - Release Patch了解。

重要变化

该版本没什么重要的语法上的变更,一些重要的变化如下

  1. 显著提高了堆的扫描性能
  2. 运行时将更积极的向操作系统释放申请的内存
  3. 用于下载 go 依赖的命令现在可以并发安全的使用

1.11

首次发布:2018-08-24

最后更新:go1.11.13 (released 2019-08-13)

go1.11 版本的详细更新日志可以前往Go 1.11 Release Notes查看,在其维护期间发布的所有补丁版本可以前往Go1.11 - Release Patch了解。

重要变化

This version has no significant syntax changes; the key updates are as follows

  1. GoMod was introduced for the first time, ending the previous chaos in dependency management
  2. First experimental support for WASM
  3. The runtime adopted a sparse heap layout, removing the heap-size limit

1.10

First release: 2018-02-16

Last update: go1.10.8 (released 2019-01-23)

go1.10 版本的详细更新日志可以前往Go 1.10 Release Notes查看,在其维护期间发布的所有补丁版本可以前往Go1.10 - Release Patch了解。

Important Changes

This version has no significant syntax changes; the key updates are as follows

  1. go install command now only used to install and compile command-line tools, no longer used to download dependencies
  2. go get command now used to download source dependencies
  3. go testing now caches test results, and automatically runs go vet before running tests
  4. Significantly reduced the delay caused by GC when active

1.9

First release: 2017-08-24

Last update: go1.9.7 (released 2018-06-05)

For detailed release notes of go1.9, please visit Go 1.9 Release Notes; for all patch versions released during its maintenance period, please check Go1.9 - Release Patch.

Language Level

  1. Support type aliases

Other

  1. Support parallel compilation
  2. Introduced concurrent-safe sync.Map

1.8

First release: 2017-02-16

Last update: go1.8.7 (released 2018-02-07)

For detailed release notes of go1.8, please visit Go 1.8 Release Notes; for all patch versions released during its maintenance period, please check Go1.8 - Release Patch.

Language Level

  1. When two structs are converted to each other, the difference in struct tags is ignored

    go
    func example() {
        type T1 struct {
            X int `json:"foo"`
        }
        type T2 struct {
            X int `json:"bar"`
        }
        var v1 T1
        var v2 T2
        v1 = T1(v2) // now legal
    }

Other

  1. Garbage collection pause time is low to 10 microseconds, much lower than 100 microseconds in most cases (can see almost every version of go improving GC)
  2. defer usage overhead is reduced by half
  3. Go calling C's overhead is reduced by half
  4. Optimized concurrent use detection of maps

1.7

First release: 2016-08-15

Last update: go1.7.6 (released 2017-05-23)

For detailed release notes of go1.7, please visit Go 1.7 Release Notes; for all patch versions released during its maintenance period, please check Go1.7 - Release Patch.

Important Changes

  1. golang.org/x/net/context is now part of the standard library
  2. gc time is significantly shorter than 1.6
  3. testing package supports subtests

1.6

First release: 2016-02-17

Last update: go1.6.4 (released 2016-12-01)

go1.6 版本的详细更新日志可以前往Go 1.6 Release Notes查看,在其维护期间发布的所有补丁版本可以前往Go1.6 - Release Patch了解。

Important Changes

This version has no significant syntax changes; the key updates are as follows

  1. Concurrent use detection of maps has been significantly improved, and if a map is used concurrently, a fatal error will be thrown
  2. When panic occurs, only the call stack of the current goroutine will be printed
  3. HTTP/2 is supported

1.5

First release: 2015-08-19

Last update: go1.5.4 (released 2016-04-12)

For detailed release notes of go1.5, please visit Go 1.5 Release Notes; for all patch versions released during its maintenance period, please check Go1.5 - Release Patch.

Language Level

  1. In map literal initialization, the element type can be omitted

    go
    m := map[Point]string{
        Point{29.935523, 52.891566}:   "Persepolis",
        Point{-25.352594, 131.034361}: "Uluru",
        Point{37.422455, -122.084306}: "Googleplex",
    }
    
    // 省略类型
    m := map[Point]string{
        {29.935523, 52.891566}:   "Persepolis",
        {-25.352594, 131.034361}: "Uluru",
        {37.422455, -122.084306}: "Googleplex",
    }

Other

  1. The runtime and compiler are completely rewritten in go, no longer containing any c code
  2. Concurrent garbage collection is supported, significantly reducing the pause time of the program
  3. The default value of GOMAXPROCS is the number of logical cores of the machine
  4. The semantic of internal package can be applied to any package, not just the source code package of go
  5. Experimental support for vendor dependency management (finally started to handle dependency management)

1.4

First release: 2014-12-10

Last update: go1.4.3 (released 2015-09-22)

For detailed release notes of go1.4, please visit Go 1.4 Release Notes; for all patch versions released during its maintenance period, please check Go1.4 - Release Patch.

Language Level

  1. for range loop can have one iteration parameter, such as

    for i := range x {
        ...
    }

    but not none

  2. When calling methods of double pointer types, no automatic dereferencing is performed

    go
    type T int
    func (T) M() {}
    var x **T
    
    // not allowed
    x.M()

Other

  1. In previous versions of go, the runtime was written in c, and now it is completely written in go
  2. The package name can be changed to internal to represent that all its contents are private and unexported

1.3

First release: 2014-06-18

Last update: go1.3.3 (released 2014-09-30)

For detailed release notes of go1.3, please visit Go 1.3 Release Notes; for all patch versions released during its maintenance period, please check Go1.3 - Release Patch.

Important Changes

This version has no significant syntax changes; the key updates are as follows

  1. Concurrent use detection of maps has been significantly improved, and if a map is used concurrently, a fatal error will be thrown
  2. When panic occurs, only the call stack of the current goroutine will be printed
  3. HTTP/2 is supported

1.2

First release: 2013-12-01

Last update: go1.2.2 (released 2014-05-05)

For detailed release notes of go1.2, please visit Go 1.2 Release Notes; for all patch versions released during its maintenance period, please check Go1.2 - Release Patch.

Language Level

  1. When operating on a variable with a value of nil, a panic will be thrown

  2. When slicing a slice, you can use the third parameter to limit the capacity of the sliced slice to ensure safe use of the slice

    go
    var array [10]int
    slice := array[2:4:4]

Other

  1. The minimum memory size of a goroutine stack has been raised from 4KB to 8KB

  2. The maximum number of threads has been limited to 10000

  3. Long-running goroutines will be preempted when they make function calls (first introduction of cooperative preemption)

1.1

First release: 2013-05-13

Last update: go1.1.2 (released 2013-08-13)

For detailed release notes of go1.1, please visit Go 1.1 Release Notes; for all patch versions released during its maintenance period, please check Go1.1 - Release Patch.

Language Level

  1. A number divided by 0 will throw a panic before go1.1, but now it cannot be compiled.
  2. Methods can exist as values.
  3. Introduced the concept of terminating statements, and the return rules of functions are more relaxed, Terminating Statements - go-sepc.

Performance

  1. Using the go1.1 toolchain to compile go programs can roughly improve performance by 30%-40%

Other

  1. On 64-bit machines, the maximum heap memory size has been raised to dozens of GB
  2. By default, cgo is disabled when cross-compiling

1.0

First release: 2012-03-28

Last update: go1.0.3 (released 2012-08-02)

Language Level

  1. In preview version, a number divided by 0 will throw a panic before go1.0, but now it cannot be compiled.
  2. Methods can exist as values.
  3. Introduced the concept of terminating statements, and the return rules of functions are more relaxed, Terminating Statements - go-sepc.

Compared to the preview version, the following things have been added to the syntax

  1. Added built-in append function to add elements to a slice

  2. Added built-in close function to close a channel

  3. Compound semantics, when initializing slice, map, struct literal elements, you can omit their types, as shown below

    go
    // Declare type
    holiday1 := []Date{
        Date{"Feb", 14},
        Date{"Nov", 11},
        Date{"Dec", 25},
    }
    
    // Omit type
    holiday2 := []Date{
        {"Feb", 14},
        {"Nov", 11},
        {"Dec", 25},
    }
  4. In init function, goroutines will be started directly, without waiting for all packages to be initialized.

  5. Added rune type to represent a UTF-8 character

  6. Added error built-in interface to represent error type

  7. Added delete built-in function to delete key-value pairs in map

  8. The order of iterating map using for range becomes unpredictable

  9. Support multiple variable assignment at once

    a := 1
    b := 2
    a, b = 3, 4
  10. Variable shadowing problem: when a function has named return values, if any of the return values are hidden, then the return statement must carry return values, otherwise the compilation will fail, the following is an error example

    go
    func Bug() (i, j, k int) {
        for i = 0; i < 5; i++ {
            for j := 0; j < 5; j++ { // Redeclares j.
                k += i * j
                if k > 100 {
                    return // Rejected: j is shadowed here.
                }
            }
        }
        return // OK: j is not shadowed here.
    }
  11. Allow copying struct values with private fields

  12. In the case where struct and slice are composed of comparable elements, they are allowed to be used as map keys at the same time, and the comparable property of functions and maps is removed

Except for the language level, go1.0 has changed significantly in terms of package organization, standard library, and command line compared to the preview version. Since the content is too much to cover here, please refer to the official website for more details.

pre

Before go1 was released, all versions were called preview versions. For these preview versions, the official website will release a snapshot version every week. Some important versions are as follows

  • r60(2011-09-07), which requires that the else block now must be bracketed
  • r59(2011-08-01), which designs a new struct tag scheme
  • r58(2011-06-29), which fixes the problem of memory not being initialized when using goto abuse, and adds gui, exec packages
  • r57(2011-05-03), which supports short variable multiple assignment syntax, re-designs http, reflect packages, and makes gotest a go program rather than a shell script
  • r56(2011-03-07), which is the first stable version

Development of the preview versions began on December 9, 2009, and ended with the official release of Go 1 on March 28, 2012, lasting nearly three years; afterward, weekly snapshots were no longer recorded. Visit Pre-Go 1 Release History for information on these major versions, and Weekly Snapshot History for the full list of weekly snapshots of all preview versions.

Golang by www.golangdev.cn edit