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)

Exercises

  1. Find and read the documentation of the time package.
  2. Try to change the Go code of userFiles.go in order to support multiple users.
  3. Change the Go code of insertLineNumber.go in order to read the input file line by line, write each line to a temporary file, and then, replace the original file with the temporary one. If you do not know how and where to create a temporary file, you can use a random number generator to get a temporary filename and the /tmp directory to temporarily save it.
  4. Make the necessary changes to multipleMV.go in order to print the files that are a match to the given regular expression without actually renaming them.
  5. Try to create a regular expression that matches PNG files and use it to process the contents of a log file.
  6. Create a regular expression that catches a date and a time string in order to print just the date part and delete the time part...