Languages Features Creators CSV Resources Challenges Add Language
GitHub icon

Go

Go - Programming language

< >

Go is a programming language created in 2009 by Rob Pike and Ken Thompson and Robert Griesemer.

#18on PLDB 14Years Old 525.2kUsers
5Books 26Papers 1mRepos

Try now: Web · Riju · TIO · Replit

Go (often referred to as golang) is a programming language created at Google in 2009 by Robert Griesemer, Rob Pike, and Ken Thompson. It is a compiled, statically typed language in the tradition of Algol and C, with garbage collection, limited structural typing, memory safety features and CSP-style concurrent programming features added. The compiler and other language tools originally developed by Google are all free and open source.. Read more on Wikipedia...


Example from Compiler Explorer:
// Type your code here, or load an example. // Your function name should start with a capital letter. package main func Square(x int) int { return x * x } func main() {}
Example from Riju:
package main import "fmt" func main() { fmt.Println("Hello, world!") }
Example from hello-world:
package main import "fmt" func main() { fmt.Println("Hello World") }
// Hello world in Go package main import "fmt" func main() { fmt.Printf("Hello World\n") }
Example from Linguist:
// Autogenerated by Thrift Compiler (1.0.0-dev) // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING package linguist import ( "bytes" "fmt" "git.apache.org/thrift.git/lib/go/thrift" ) // (needed to ensure safety because of naive import list construction.) var _ = thrift.ZERO var _ = fmt.Printf var _ = bytes.Equal func init() { }
Example from Wikipedia:
package main import ( "fmt" "time" ) func readword(ch chan string) { fmt.Println("Type a word, then hit Enter.") var word string fmt.Scanf("%s", &word) ch <- word } func timeout(t chan bool) { time.Sleep(5 * time.Second) t <- true } func main() { t := make(chan bool) go timeout(t) ch := make(chan string) go readword(ch) select { case word := <-ch: fmt.Println("Received", word) case <-t: fmt.Println("Timeout.") } }

Keywords in Go

break case chan const continue default defer else fallthrough for func go goto if import interface map package range return select struct switch type var

Language features

Feature Supported Token Example
Floats ✓
// \d+(\.\d+[eE][+\-]?\d+|\.\d*|[eE][+\-]?\d+)
Hexadecimals ✓
// 0[xX][0-9a-fA-F]+
Octals ✓
// 0[0-7]+
Conditionals ✓
Switch Statements ✓
Constants ✓
Case Sensitivity ✓
Assignment ✓ =
Print() Debugging ✓ fmt.Println
Message Passing ✓
Line Comments ✓ //
// A comment
Variadic Functions ✓
// This variadic function takes an arbitrary number of ints as arguments.
func sum(nums ...int) {
  fmt.Print("The sum of ", nums) // Also a variadic function.
  total := 0
  for _, num := range nums {
    total += num
  }
  fmt.Println(" is", total) // Also a variadic function.
}
Type Inference ✓
Lists ✓
myList := []int{1, 2, 3}
File Imports ✓
import (
   "fmt"
   "math"
)
import . "fmt"
import _ "io"
import log "github.com/foo/bar"
import m "math"
Increment and decrement operators ✓
i := 0
i++
i--
Integers ✓
i, j := 42, 2701
Booleans ✓
c := true
MultiLine Comments ✓ /* */
/* A comment
*/
Comments ✓
// This is a comment
Pointers ✓
package main

import "fmt"

func main() {
  i, j := 42, 2701

  p := &i         // point to i
  fmt.Println(*p) // read i through the pointer
  *p = 21         // set i through the pointer
  fmt.Println(i)  // see the new value of i

  p = &j         // point to j
  *p = *p / 37   // divide j through the pointer
  fmt.Println(j) // see the new value of j
}
Strings ✓ "
"hello world"
Case Insensitive Identifiers X
Semantic Indentation X
Operator Overloading X

Books about Go from ISBNdb

title authors year publisher
The Way To Go: A Thorough Introduction To The Go Programming Language Balbaert, Ivo 2012 iUniverse
Go Programming Blueprints: Build real-world, production-ready solutions in Go using cutting-edge technology and techniques, 2nd Edition Ryer, Mat 2016 Packt Publishing
TouchDevelop: Programming on the Go (Expert's Voice in Web Development) Horspool, Nigel and Tillmann, Nikolai and Bishop, Judith 2013 Apress
Go Web Programming Chang, Sau Sheong 2016 Manning Publications
Go Programming Blueprints Ryer, Mat 2015 Packt Publishing

Publications about Go from Semantic Scholar

title authors year citations influentialCitations
Structured Programming with go to Statements D. Knuth 1974 685 25
When good instructions go bad: generalizing return-oriented programming to RISC E. Buchanan and Ryan Roemer and H. Shacham and S. Savage 2008 403 28
The Go Programming Language Jeffrey H. Meyerson 2014 278 7
Static deadlock detection for concurrent go by global session graph synthesis Nicholas Ng and N. Yoshida 2016 54 2
A Static Verification Framework for Message Passing in Go Using Behavioural Types J. Lange and Nicholas Ng and Bernardo Toninho and N. Yoshida 2018 50 2
Understanding Real-World Concurrency Bugs in Go Tengfei Tu and Xiaoyu Liu and Linhai Song and Yiying Zhang 2019 45 4
GoHotDraw: evaluating the Go programming language with design patterns Frank Schmager and N. Cameron and J. Noble 2010 23 1
Go at Google R. Pike 2012 22 0
An Empirical Study of Messaging Passing Concurrency in Go Projects Nicolas Dilley and J. Lange 2019 22 1
Here We Go Again: Why Is It Difficult for Developers to Learn Another Programming Language? Nischal Shrestha and Colton Botta and Titus Barik and Chris Parnin 2020 19 1
Concurrency in Go and Java: Performance analysis Naohiro Togashi and V. Klyuev 2014 16 4
Architecture-Based Code Generation: From π-ADL Architecture Descriptions to Implementations in the Go Language Everton Cavalcante and F. Oquendo and T. Batista 2014 14 1
bíogo: a simple high-performance bioinformatics toolkit for the Go language R. Kortschak and Josh Bleecher Snyder and Manolis Maragkakis and D. Adelson 2014 12 1
Deferred gratification: engineering for high performance garbage collection from the get go Ivan Jibaja and S. Blackburn and M. Haghighat and K. McKinley 2011 11 0
FML-based Dynamic Assessment Agent for Human-Machine Cooperative System on Game of Go Chang-Shing Lee and Mei-Hui Wang and Sheng-Chi Yang and Pi-Hsia Hung and Su-Wei Lin and Nan Shuo and N. Kubota and Chun-Hsun Chou and P. Chou and Chia-Hsiu Kao 2017 11 0
Static Race Detection and Mutex Safety and Liveness for Go Programs (Artifact) Julia Gabet and N. Yoshida 2020 10 1
goDASH — GO Accelerated HAS Framework for Rapid Prototyping Darijo Raca and Maëlle Manifacier and Jason J. Quinlan 2020 7 0
GoBench: A Benchmark Suite of Real-World Go Concurrency Bugs Ting Yuan and Guangwei Li and Jie Lu and Chen Liu and Lian Li and Jingling Xue 2021 7 3
Two-Phase Dynamic Analysis of Message-Passing Go Programs Based on Vector Clocks M. Sulzmann and K. Stadtmüller 2018 6 0
Trace-Based Run-Time Analysis of Message-Passing Go Programs M. Sulzmann and K. Stadtmüller 2017 5 1
Bounded verification of message-passing concurrency in Go using Promela and Spin Nicolas Dilley and J. Lange 2020 4 0
PARAGON: an approach for parallelization of power system contingency analysis using Go programming language S. Khaitan and J. McCalley 2015 4 1
Static Race Detection and Mutex Safety and Liveness for Go Programs (extended version) Julia Gabet and N. Yoshida 2020 3 1
Overview of the Go Language J. Newmarch 2017 3 1
Pattern matching for object-like structures in the Go programming language Chanwit Kaewkasi and Pitchaya Kaewkasi 2011 2 0
Evaluating the GO Programming Language with Design Patterns Frank Schmager null 1 0
json.html · go.html · cobol.html

View source

- Build the next great programming language · Search · Day 213 · About · Blog · Acknowledgements · Traffic · Traffic Today · GitHub · feedback@pldb.com