40 Fun Facts About Go Programming Language
Learn something new, then test yourself with the quiz.
Know these facts? Prove it.
Take the 40-question quizWhich technology company created the Go language, unveiling it as an open-source project in November 2009?
Google began designing the language in 2007 to make programmers more productive on multicore machines and very large codebases. Version 1.0 followed in March 2012.
Which animal, first drawn by Renée French for a radio station T-shirt, became the mascot of the Go language?
The Go Gopher first promoted the New Jersey radio station WFMU, long before the language existed. The same drawing later served as a Bell Labs mail avatar.
Which DevOps tool, started in France by Solomon Hykes and released in 2013, is written in Go?
Docker began as an internal project at the hosting firm dotCloud, which later renamed itself after the tool. A year after launch it swapped the Linux tool LXC for a Go component of its own.
Which container orchestration system, written in Go, takes its name from the Ancient Greek word for a helmsman?
Kubernetes shares its Greek root with the words cybernetics and governor. Its logo is a ship's wheel with seven spokes, a nod to the codename Project 7.
Go's designers were motivated by a shared dislike of which language, then used for huge programs at their workplace?
C++ builds of one huge program were taking Rob Pike about 45 minutes each. The decision to create something new was made before one of those builds had finished.
Which co-designer of Go shared the 1983 Turing Award with Dennis Ritchie for creating the Unix operating system?
Ken Thompson had already created the B language, the ancestor of C, and built the chess machine Belle. He was in his sixties when work on Go began.
Go's formal grammar ends every statement with which punctuation mark, though programmers rarely type it themselves?
Semicolons are added by Go's lexer at the ends of lines as it scans the source. That rule is why the opening brace of an if or for statement cannot go on the next line.
Go's standard code formatter settles a long-running programmer argument by indenting each level with what?
One tab per level is what the formatter emits by default, and the official style guide says to use spaces only if you must. It also sets no limit on line length.
The Go compiler refuses to build any program that contains what, a rule meant to keep compilation fast?
An unused import stops the build outright, and so does an unused local variable. The designers chose to trade short-term convenience for build speed and clearer programs.
The nickname Golang was never the official name of Go; it arose from which part of the early project?
Its website address was originally golang.org, because no .dev domain existed at the time. The team still says the name of the language is just plain Go.
A runnable Go program must begin in a package with which name, shared with the function where execution starts?
main names both the package and the function, which takes no arguments and returns no value. The moment that function returns, the whole program exits.
Go has a single looping construct that also does the job of a while loop; which keyword starts it?
for is the only loop keyword in Go, and there is no do-while either. Written with just a condition it acts like while, and written with nothing at all it runs forever.
Unlike C, Go reclaims memory that a program no longer uses through which automatic runtime mechanism?
Garbage collection in Go has been tuned until its pauses often last under a millisecond, even for large heaps. On multicore machines the collector works alongside the running program.
Go deliberately leaves out which pillar of object-oriented design, offering type embedding in its place?
Inheritance was dropped because the designers felt object-oriented languages spend too much effort on the relationships between types. Go has no type hierarchy at all.
Go's designers wanted the readability of Python but kept which approach to types, borrowed from C?
Static typing fixes every variable's type before the program runs, so the compiler catches many mistakes. Go lightens the paperwork by inferring types from assigned values.
Which Go identifier is the zero value of pointers and function values, doing the job other languages give to null?
nil is a predeclared identifier rather than a reserved keyword. Booleans start as false, numbers as 0 and strings as empty text, so no Go variable is ever left uninitialised.
By long-standing convention, how does a Go function such as os.Open tell its caller that something went wrong?
Returning an error as an extra result is the Go way, made easy because functions can hand back several values. The designers felt try-catch blocks lead to convoluted code.
Which kind of Go type is satisfied automatically by any type that happens to have the right set of methods?
Interface satisfaction is implicit in Go: a type qualifies simply by having the listed methods, nothing more. New ones can therefore be defined later without touching existing code.
In Go, what does a program create by writing the keyword go in front of a function call?
A goroutine starts with a stack of just a few kilobytes that grows only when needed. That makes it practical to run hundreds of thousands of them in a single program.
Geth, one of three original client programs written for which blockchain, is built in the Go language?
Ethereum's backers funded three separate implementations of its protocol at the outset. Geth was the Go one, written alongside a version in Python.
Which Go type lets concurrently running functions pass values to one another, using the <- arrow operator?
Channel sends wait until the other side has taken the value, unless a buffer has been set up. That built-in pause keeps the two sides in step without any explicit locking.
Which Go keyword schedules a function call to run just before the surrounding function returns, often to close a file?
defer calls run in last-in, first-out order, so the most recently scheduled one fires first. Because the cleanup sits right beside the code that opened the resource, it is hard to forget.
Which Go operator declares a new variable and assigns its first value in one step, but only inside functions?
The := form is called a short variable declaration, and the compiler works out the type from the value on the right. Outside a function, declarations need a keyword such as var.
A Go function can be called from other packages only if its name begins with what?
A capital letter is all it takes, because Go has no public or private keywords. Any name that starts in lower case stays hidden inside the package that declares it.
Which Go keyword, shared with C, defines a composite type made up of a sequence of named fields?
struct types can have methods attached in Go, and one can be embedded inside another to borrow its fields and methods. Each field has a name and a type of its own.
Which Go type is a flexible view onto an underlying array, growing through the built-in append function?
Slice capacity is limited by the array underneath, so when appended data no longer fits, the contents move to a new, larger array. Most Go code uses them in place of raw arrays.
Which built-in Go type stores key-value pairs and hands them back in no guaranteed order when looped over?
Map iteration order is left unspecified and can differ from one loop to the next. A program that needs a stable order has to keep its own sorted list of keys.
Which tool shipped with Go rewrites source files into one standard layout, so that all Go code looks alike?
gofmt has formatted all of the code in the standard packages. It even lines up the comments on neighbouring lines into tidy columns, a chore few programmers would do by hand.
Which long-requested feature finally arrived in Go with version 1.18, released in March 2022?
Generics let one function work with many types by declaring type parameters. Their absence had drawn considerable criticism since the earliest versions of Go.
Go source code is defined to be text in which encoding, co-invented in 1992 by two of Go's designers?
UTF-8 was first sketched on a placemat in a New Jersey diner, then built into an operating system within days. It has since become the dominant text encoding of the web.
Which file at the root of a Go module declares the module's path and lists the dependencies it requires?
go.mod has a companion file of hashes, so the go command can confirm that downloaded dependencies have not been modified since they were first fetched.
Applied to a Go string, the built-in len function counts what, so that non-English text can score higher than expected?
Bytes are what len counts, because a Go string is at heart an unchangeable sequence of them. Text beyond plain English letters needs more than one for each character.
Which flag, added to go test or go build, switches on Go's detector for unsynchronised access to shared memory?
The -race flag makes the tool watch memory accesses while the program runs. It can only report clashes that actually happen during that run, so realistic workloads find more of them.
Go's concurrency derives from communicating sequential processes, an idea published in 1978 by which British scientist?
Tony Hoare's model also gave rise to the languages Occam and Erlang. Its central idea is that separate processes cooperate by passing messages rather than by sharing data.
The artist behind Go's mascot earlier drew a rabbit called Glenda for which Bell Labs operating system?
Plan 9 took its name from Plan 9 from Outer Space, Ed Wood's cult science-fiction film. Two of the three original designers of Go had helped to build the system.
Which Go identifier, sharing its name with a Greek letter, produces successive integer constants in a const block?
iota starts again at zero in every constant declaration and climbs by one with each line. It is the usual Go way to write a set of related values such as the days of the week.
Which Go type, an alias for int32, holds a single Unicode code point such as one letter or emoji?
rune is the shorter word Go introduced for a code point, a term its authors called a bit of a mouthful. A single-quoted constant such as 'x' has this type.
Which Go statement looks like a switch but waits on several communication operations at once?
select picks one at random when several of its cases are ready at the same moment. Give it a default case and it will not wait at all.
In the Go method declaration func (c Circle) Area(), what is the name for the parenthesised part before Area?
Receiver is the official term, and it can be a value or a pointer. Only the pointer form lets a method change the original, because a value form works on a copy.
Which Go co-designer previously worked on the V8 JavaScript engine and the Java HotSpot virtual machine?
Robert Griesemer is Swiss and earned his doctorate at ETH Zurich, where the language designer Niklaus Wirth was one of his supervisors.
Think you know Go Programming Language?
Put these facts to the test with the interactive quiz.
Take the 40-question quizTeaching Go Programming Language?
Make a custom quiz — handy for classrooms and study groups.
Make a quiz on anything