Go (programming language)

From Wikipedia, the free encyclopedia
Go
ParadigmMulti-paradigm: concurrent imperative, object-oriented[1][2]
Designed byRobert Griesemer
Rob Pike
Ken Thompson
DeveloperThe Go Authors[3]
First appearedNovember 10, 2009; 13 years ago
Stable release
1.20.7[4] Edit this on Wikidata / 1 August 2023; 3 days ago
Typing disciplineInferred, static, strong,[5] structural,[6][7] nominal
Implementation languageGo, Assembly language (gc); C++ (gofrontend)
OSDragonFly BSD, FreeBSD, Linux, macOS, NetBSD, OpenBSD,[8] Plan 9,[9] Solaris, Windows
License3-clause BSD[3] + patent grant[10]
Filename extensions.go
Websitego.dev
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:

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]

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

Mascot of Go programming language is a Gopher shown above.

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]

ReleaseStatusRelease dateMaintenance end
go1End-of-Life2012-03-282013-12-01
go1.1End-of-Life2013-05-132014-06-18
go1.2End-of-Life2013-12-012014-12-10
go1.3End-of-Life2014-06-182015-08-19
go1.4End-of-Life2014-12-102016-02-17
go1.5End-of-Life2015-08-192016-08-15
go1.6End-of-Life2016-02-172017-02-16
go1.7End-of-Life2016-08-152017-08-24
go1.8End-of-Life2017-02-162018-02-16
go1.9End-of-Life2017-08-242018-08-24
go1.10End-of-Life2018-02-162019-02-25
go1.11End-of-Life2018-08-242019-09-03
go1.12End-of-Life2019-02-252020-02-25
go1.13End-of-Life2019-09-032020-08-11
go1.14End-of-Life2020-02-252021-02-16
go1.15End-of-Life2020-08-112021-08-16
go1.16End-of-Life2021-02-162022-03-15
go1.17End-of-Life2021-08-162022-08-02
go1.18End-of-Life2022-03-152023-02-01
go1.19Maintenance2022-08-02Q3 2023
go1.20Current2023-02-01Q1 2024
go1.21PlannedQ3 2023Q3 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 verificationsee discussion]), but with an emphasis on greater simplicity and safety. It consists of:

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]


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *