Book Image

Go Systems Programming

Book Image

Go Systems Programming

Overview of this book

Go is the new systems programming language for Linux and Unix systems. It is also the language in which some of the most prominent cloud-level systems have been written, such as Docker. Where C programmers used to rule, Go programmers are in demand to write highly optimized systems programming code. Created by some of the original designers of C and Unix, Go expands the systems programmers toolkit and adds a mature, clear programming language. Traditional system applications become easier to write since pointers are not relevant and garbage collection has taken away the most problematic area for low-level systems code: memory management. This book opens up the world of high-performance Unix system applications to the beginning Go programmer. It does not get stuck on single systems or even system types, but tries to expand the original teachings from Unix system level programming to all types of servers, the cloud, and the web.
Table of Contents (13 chapters)

Creating good random passwords

This section will illustrate how to create good random passwords in Go, in order to protect the security of your Unix machines. The main reason for including it here instead of another chapter is because the presented Go program will use the /dev/random device, which is a file defined by your Unix system, for getting the seed of the random number generator.
The name of the Go program will be goodPass.go, and it will require just one optional parameter, which will be the length of the generated password: the default size of the generated password will be 10 characters. Additionally, the program will generate ASCII characters starting from ! up to z. The ASCII code of the exclamation mark is 33, whereas the ASCII code of small z is 122.

The first part of goodPass.go is the required preamble:

package main 
 
import ( 
   "encoding/binary"...