Go .. C of 21st century

Go language, it is a statically typed compiled language and it is often described as c for the 21st century!

It was created at google in 2007 by legends who really know their stuff like Ken Thompson the inventor of the (b) and (c) programming language…


This content originally appeared on DEV Community and was authored by Bek Brace

Go language, it is a statically typed compiled language and it is often described as c for the 21st century!

It was created at google in 2007 by legends who really know their stuff like Ken Thompson the inventor of the (b) and (c) programming languages; and then version 1.0 was released as open source software in 2012; and the was design was meant to be simple and efficient and that's why we call it go.

The source code is compiled down to machine code which means it generally outperforms interpreted languages but it's famous for its extremely fast compile times made possible by innovations to dependency analysis and even though it's a statically typed language it performs type inference to deliver a syntax that is very concise and practical.

It also has a package and module system making it easy to import and export code between projects to get started install go and then open an empty directory on your system.

Create a file ending in go then add package main at the top to create a standalone executable then
declare a main function which is where your program will start executing

Image description

Go has a standard library of core packages to handle common requirements like math networking or formatted io by importing "fmt" we can print a line to the standard output then run the go build command and it quickly compiles the source code and dependencies into an executable binary.

Image description

Image description

When it comes to dependencies we can also link to remote packages on github.

Run go mod init from the command line and that creates a go module file that enables dependency tracking.

Go is like a concise version of c or c plus plus if you know any of those languages, you declare a
variable with the var keyword followed by its name and type and initialize it with a value or you might use the short assignment syntax to replace var and let go automatically infer the type and you can define multiple variables from a single line go has all the other features you would expect in a programming language like arrays maps loops and control flow but also allows you to store the memory address of a value using pointers while disallowing pointer arithmetic which often leads to dangerous and unpredictable behavior in
addition it supports concurrency with go routines which are functions that can run at the same time as other functions by utilizing multiple threads on a cpu.


This content originally appeared on DEV Community and was authored by Bek Brace


Print Share Comment Cite Upload Translate Updates
APA

Bek Brace | Sciencx (2021-10-20T16:16:00+00:00) Go .. C of 21st century. Retrieved from https://www.scien.cx/2021/10/20/go-c-of-21st-century/

MLA
" » Go .. C of 21st century." Bek Brace | Sciencx - Wednesday October 20, 2021, https://www.scien.cx/2021/10/20/go-c-of-21st-century/
HARVARD
Bek Brace | Sciencx Wednesday October 20, 2021 » Go .. C of 21st century., viewed ,<https://www.scien.cx/2021/10/20/go-c-of-21st-century/>
VANCOUVER
Bek Brace | Sciencx - » Go .. C of 21st century. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/10/20/go-c-of-21st-century/
CHICAGO
" » Go .. C of 21st century." Bek Brace | Sciencx - Accessed . https://www.scien.cx/2021/10/20/go-c-of-21st-century/
IEEE
" » Go .. C of 21st century." Bek Brace | Sciencx [Online]. Available: https://www.scien.cx/2021/10/20/go-c-of-21st-century/. [Accessed: ]
rf:citation
» Go .. C of 21st century | Bek Brace | Sciencx | https://www.scien.cx/2021/10/20/go-c-of-21st-century/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.