Go (often called Golang) is a statically typed, compiled programming language created at Google and released publicly in 2009. It aims for simple syntax, fast compilation, garbage collection and built-in support for concurrent programs.
Why it matters
Go compiles to a single static binary with no separate runtime to install, which makes deployment simple. Its lightweight concurrency model, based on goroutines and channels, suits network servers, command-line tools and infrastructure software; Docker and Kubernetes are both written in Go. The language deliberately omits many features (it added generics only in version 1.18), trading expressiveness for readability and consistent code across teams.
Example
package main
import "fmt"
func main() {
ch := make(chan string)
go func() { ch <- "ping" }()
fmt.Println(<-ch)
}
The go keyword starts a goroutine that sends a message into the channel, and the main function waits to receive it, printing ping.
Common mistakes
- Ignoring returned
errorvalues, since Go uses explicit errors instead of exceptions. - Starting goroutines without a way to stop them, which leaks them.
- Sharing data between goroutines without synchronization, causing a race condition.
Related
Get notified when this term updates
Plus occasional practical tips on uptime and monitoring, nothing else. Unsubscribe anytime.
यह पेज सामान्य जानकारी है, जिसे हमारी संपादकीय टीम ने लिखा है और दस्तावेज़ीकरण बदलने पर अपडेट किया जाता है। सर्वर और प्रदाता अलग-अलग होते हैं, इसलिए बदलाव पहले सुरक्षित तरीके से जाँचें। देखें: संपादकीय नीति और अस्वीकरण.