The ‘Go’ language (also known as Golang) is among the most rapidly used scripting languages. The designers of UNIX and C, Ken Thompson, Rob Pike, and Robert Griesemer, collaborated on developing this open-source language, which was made available by Google in 2009. It is a flexible programming language primarily to create applications that scale and run more quickly. Despite being known for a while, the rise of cloud computing and microservices have made it more difficult for developers to adopt Go widely. Major corporations like Google, Dropbox, Uber, and Dailymotion use Go extensively. This article at InfoQ by Sergio De Simone speaks about the growing traction of GO as a scripting language.
Introduction to Go Language
Developer interest in Go’s use as a scripting language has increased as a result of the language’s expanding use as a tool for building high-performance networked and concurrent systems. On a side note, Go developer and former Googler David Crawshaw emphasizes the convenience of utilizing Go for scripting chores for all coders spending most of their time creating more complicated programs in Go. Go is also a strongly typed language, adds Cloudflare engineer Ignat Korchagin, making Go programs more dependable and less likely to fail at runtime owing to such minor mistakes as typos. As part of their CI/CD pipeline and development methodology, Codenation employed Go to build scripts that automated repetitive operations.
Codenation engineers use the following Go packages:
- github.com/fatih/color to colorize Go output.
- github.com/schollz/progressbar to create progress bars for lengthy operations.
- github.com/jimlawless/whereami to capture information on the filename, line number, function, etc., where it is used. This is useful to improve error messages.
- github.com/spf13/cobra to make it easier to create complex scripts with input processing, options, and related documentation.
Pros and Cons
Go lacks explicit support for a read-eval-print loop (REPL) and is challenging to integrate with the shebang (#! ), which allows scripts to be run like binary programs. Gomacro, a Go interpreter that also enables Lisp-like macros to generate and analyze code, adopts a similar strategy to Neugram. Go is ideally suited for scripting, but Gomacro also seeks to provide a Go source code debugger and the ability to utilize Go as an intermediary language to express complex specifications that will convert into standard Go.
To read the original article, click on https://www.infoq.com/news/2020/04/go-scripting-language/