![]() |
VOOZH | about |
We’re so glad you’re here. You can expect all the best TNS content to arrive Monday through Friday to keep you on top of the news and at the top of your game.
Check your inbox for a confirmation email where you can adjust your preferences and even join additional groups.
Follow TNS on your favorite social media networks.
Become a TNS follower on LinkedIn.
Check out the latest featured and trending stories while you wait for your first TNS newsletter.
The Go programming language (aka Golang) is a versatile programming language that is used for building low-level infrastructure, web applications and services, cloud native applications, distributed systems, networked applications, concurrent processing tasks, networking tools, proxies and command-line tools, and also works well for containers, IoT and embedded systems. The main reason why Go is so popular is its speed. Developers who use Golang as their go-to option will tell you that it has one of the fastest compile times of any language. Unlike Python, Go is a compiled language that is statically typed, explicit and modeled after the C programming language. Even so, Go was inspired by the simplicity of Python. And because Go uses goroutines (a lightweight execution thread and function that executes concurrently with the rest of a Go program), it can produce programs that are able to run multiple processes at the same time (concurrency). Go was created in 2007 by Google to eliminate some of the issues that they identified when developing software internally (such as slow build times and better concurrency). Google also wanted to create a language that would help make the development process more productive and scalable. What they ultimately wanted was a simple, efficient and easy-to-use programming language. Hence, Golang.
| PRO | CON |
| Simplicity and easy to learn and use | Allows for sloppy coding practices |
| Concurrency | Lack of libraries |
| Fast compilation | Static typing can create less flexible code |
| Built-in testing (with good error messages) | Comparatively small community |
| Garbage collection | While compile time is very fast, compiled code isn’t the fastest. |
| Can use all CPU cores efficiently | No inheritance |
| Best-in-class documentation | |
| Fairly powerful profiling tools | |
| Eliminates the distinction between synchronous and asynchronous code |
sudo snap install go --classic
sudo apt-get install golang-go -y
go version
go version go1.22.1 linux/amd64
mkdir go_projects
cd go_projectsNow create the “Hello, World” file with this command:
nano hello.goIn that file, paste the following:
package main
import "fmt"
func main() {
fmt.Println("Hello, New Stack")
}
What does it all mean? Let’s break it down, line by line.
go run hello.go
Hello, New StackYou’ll notice that Go does not create an executable file. Unlike languages like Python, Go includes the ability to generate an executable application from your .go file. Sticking with our hello.go file, the command for this would be:
go build hello.go
./hello
GOOS=darwin GOARCH=amd64 go build hello.go
GOOS=darwin GOARCH=arm64 go build hello.go
go tool dist list