This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages)
|
Paradigm | Multi-paradigm: concurrent imperative, object-oriented[1][2] |
---|---|
Designed by | Robert Griesemer Rob Pike Ken Thompson |
Developer | The Go Authors[3] |
First appeared | November 10, 2009 |
Stable release | 1.20.7[4] / 1 August 2023 |
Typing discipline | Inferred, static, strong,[5] structural,[6][7] nominal |
Implementation language | Go, Assembly language (gc); C++ (gofrontend) |
OS | DragonFly BSD, FreeBSD, Linux, macOS, NetBSD, OpenBSD,[8] Plan 9,[9] Solaris, Windows |
License | 3-clause BSD[3] + patent grant[10] |
Filename extensions | .go |
Website | go |
Major implementations | |
gc, gofrontend | |
Influenced by | |
C, Oberon-2, Limbo, Active Oberon, communicating sequential processes, Pascal, Oberon, Smalltalk, Newsqueak, Modula-2, Alef, APL, BCPL, Modula, occam | |
Influenced | |
Crystal, V (programming language) |
Go is a statically typed, compiled high-level programming language designed at Google[11] by Robert Griesemer, Rob Pike, and Ken Thompson.[12] It is syntactically similar to C, but also has memory safety, garbage collection, structural typing,[6] and CSP-style concurrency.[13] It is often referred to as Golang because of its former domain name, golang.org
, but its proper name is Go.[14]
There are two major implementations:
- Google’s self-hosting[15] “gc” compiler toolchain, targeting multiple operating systems and WebAssembly.[16]
- gofrontend, a frontend to other compilers, with the libgo library. With GCC the combination is gccgo;[17] with LLVM the combination is gollvm.[18][a]
A third-party source-to-source compiler, GopherJS,[20] compiles Go to JavaScript for front-end web development.
History
Go was designed at Google in 2007 to improve programming productivity in an era of multicore, networked machines and large codebases.[21] The designers wanted to address criticism of other languages in use at Google, but keep their useful characteristics:[22]
- Static typing and run-time efficiency (like C)
- Readability and usability (like Python)[23]
- High-performance networking and multiprocessing
Its designers were primarily motivated by their shared dislike of C++.[24][25][26]
Go was publicly announced in November 2009,[27] and version 1.0 was released in March 2012.[28][29] Go is widely used in production at Google[30] and in many other organizations and open-source projects.
Branding and styling
The Gopher mascot was introduced in 2009 for the open source launch of the language. The design, by Renée French, borrowed from a c. 2000 WFMU promotion.[31]
In November 2016, the Go and Go Mono fonts were released by type designers Charles Bigelow and Kris Holmes specifically for use by the Go project. Go is a humanist sans-serif resembling Lucida Grande, and Go Mono is monospaced. Both fonts adhere to the WGL4 character set and were designed to be legible with a large x-height and distinct letterforms. Both Go and Go Mono adhere to the DIN 1450 standard by having a slashed zero, lowercase l
with a tail, and an uppercase I
with serifs.[32][33]
In April 2018, the original logo was replaced with a stylized GO slanting right with trailing streamlines. (The Gopher mascot remained the same.[34])
Generics
The lack of support for generic programming in initial versions of Go drew considerable criticism.[35] The designers expressed an openness to generic programming and noted that built-in functions were in fact type-generic, but are treated as special cases; Pike called this a weakness that might be changed at some point.[36] The Google team built at least one compiler for an experimental Go dialect with generics, but did not release it.[37]
In August 2018, the Go principal contributors published draft designs for generic programming and error handling and asked users to submit feedback.[38][39] However, the error handling proposal was eventually abandoned.[40]
In June 2020, a new draft design document[41] was published that would add the necessary syntax to Go for declaring generic functions and types. A code translation tool, go2go, was provided to allow users to try the new syntax, along with a generics-enabled version of the online Go Playground.[42]
Generics were finally added to Go in version 1.18.[43]
Versioning
Go 1 guarantees compatibility[44] for the language specification and major parts of the standard library. All versions up to the current Go 1.20 release[45] have maintained this promise.
Each major Go release is supported until there are two newer major releases.[46]
Release | Status | Release date | Maintenance end |
---|---|---|---|
go1 | End-of-Life | 2012-03-28 | 2013-12-01 |
go1.1 | End-of-Life | 2013-05-13 | 2014-06-18 |
go1.2 | End-of-Life | 2013-12-01 | 2014-12-10 |
go1.3 | End-of-Life | 2014-06-18 | 2015-08-19 |
go1.4 | End-of-Life | 2014-12-10 | 2016-02-17 |
go1.5 | End-of-Life | 2015-08-19 | 2016-08-15 |
go1.6 | End-of-Life | 2016-02-17 | 2017-02-16 |
go1.7 | End-of-Life | 2016-08-15 | 2017-08-24 |
go1.8 | End-of-Life | 2017-02-16 | 2018-02-16 |
go1.9 | End-of-Life | 2017-08-24 | 2018-08-24 |
go1.10 | End-of-Life | 2018-02-16 | 2019-02-25 |
go1.11 | End-of-Life | 2018-08-24 | 2019-09-03 |
go1.12 | End-of-Life | 2019-02-25 | 2020-02-25 |
go1.13 | End-of-Life | 2019-09-03 | 2020-08-11 |
go1.14 | End-of-Life | 2020-02-25 | 2021-02-16 |
go1.15 | End-of-Life | 2020-08-11 | 2021-08-16 |
go1.16 | End-of-Life | 2021-02-16 | 2022-03-15 |
go1.17 | End-of-Life | 2021-08-16 | 2022-08-02 |
go1.18 | End-of-Life | 2022-03-15 | 2023-02-01 |
go1.19 | Maintenance | 2022-08-02 | Q3 2023 |
go1.20 | Current | 2023-02-01 | Q1 2024 |
go1.21 | Planned | Q3 2023 | Q3 2024 |
Legend: Old version Older version, still maintained Latest version Future release |
Design
Go is influenced by C (especially the Plan 9 dialect[47][failed verification – see discussion]), but with an emphasis on greater simplicity and safety. It consists of:
- A syntax and environment adopting patterns more common in dynamic languages:[48]
- Optional concise variable declaration and initialization through type inference (
x := 0
instead ofvar x int = 0;
orvar x = 0;
) - Fast compilation[49]
- Remote package management (
go get
)[50] and online package documentation[51]
- Optional concise variable declaration and initialization through type inference (
- Distinctive approaches to particular problems:
- Built-in concurrency primitives: light-weight processes (goroutines), channels, and the
select
statement - An interface system in place of virtual inheritance, and type embedding instead of non-virtual inheritance
- A toolchain that, by default, produces statically linked native binaries without external Go dependencies
- Built-in concurrency primitives: light-weight processes (goroutines), channels, and the
- A desire to keep the language specification simple enough to hold in a programmer’s head,[52] in part by omitting features that are common in similar languages.
Syntax
Go’s syntax includes changes from C aimed at keeping code concise and readable. A combined declaration/initialization operator was introduced that allows the programmer to write i := 3
or s := "Hello, world!"
, without specifying the types of variables used. This contrasts with C’s int i = 3;
and const char *s = "Hello, world!";
.
Semicolons still terminate statements;[b] but are implicit when the end of a line occurs.[c]
Methods may return multiple values, and returning a result, err
pair is the conventional way a method indicates an error to its caller in Go.[d] Go adds literal syntaxes for initializing struct parameters by name and for initializing maps and slices. As an alternative to C’s three-statement for
loop, Go’s range
expressions allow concise iteration over arrays, slices, strings, maps, and channels.[55]
Leave a Reply