Home > Article > Backend Development > The language borrowing genealogy of Go language
The Go language borrows from four languages: Algol (modularity and concurrency), C (syntax and type system), Oberon (module system and concurrency model), and Smalltalk (garbage collector and interface mechanism). These borrowed elements contribute to the modern, safe and easy-to-use features of the Go language, as shown in the following practical case: creating an HTTP server that prints the parameters in the request, reflecting the influence of the C language (syntax and type system), Oberon The impact of the language (module system and concurrency model) and the impact of the Smalltalk language (garbage collector).
Go language's language borrowing genealogy
Introduction
Go language by Rob · Designed and developed by Pike, Robert Grisham, and Ken Thompson at Google in 2009. Since then, it has become a popular programming language used to build a variety of applications. The Go language borrows from several other programming languages, including:
Practical case: Web application
Let us use a practical case to demonstrate the language reference of Go language. We create a simple HTTP server that prints the parameters in the request to the terminal.
package main import ( "fmt" "log" "net/http" ) func main() { // 创建一个 HTTP 处理程序。 http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { // 遍历请求的参数。 for k, v := range r.URL.Query() { // 打印键值对。 fmt.Fprintf(w, "%s: %s\n", k, v) } }) //启动 HTTP 服务器。 log.Fatal(http.ListenAndServe(":8080", nil)) }
In the above code:
By combining the features of these different languages, the Go language creates a modern, safe and easy-to-use programming language.
The above is the detailed content of The language borrowing genealogy of Go language. For more information, please follow other related articles on the PHP Chinese website!