Skip to main content

Golearn

·5 mins

This project is my personal path to learning the Go programming language. The plan includes the following goals:

  • ☑ Completing the Tour of Go tutorial. My solutions to the exercises are available from the snippets section in Gitlab.

  • ☑ Reading the Go System Programming book and writing Go programs inspired by the exercises listed at the end of each chapter. See the Changelog section below for references to all Go programs that I wrote for this goal.

  • ☑ Reading the Mastering Go book and writing Go programs for each chapter. The objective is to explore advanced Go features.

  • ☞ Reading the Building Microservices with Go book, and other similar material; write a sample but complete application using microservices and deploy it in Google Cloud. This goal is my current focus.

Source code for the learning exercises is available from the master branch of my Golearn project in Gitlab. The development branch holds work in progress.

Changelog #

  • ☑ [Jul 29, 2019] I finished reading Mastering Go. There is not much new material when compared with the Go System Programming book and the exercises I have developed already. The only exception is chapter 11, Code Testing, Optimization, and Profiling. In particular, using the Go profiler and the Go native cross-compilation capabilities were new topics to me.

  • [July 3, 2019] Exercises for chapter 2 of Mastering Go are complete. Chapter 2 includes an example of passing a Go string to C but not the opposite. I wrote a program to retrieve the uname information from C and pass it as a string to Go.
    Programs: cenv

  • [Oct 15, 2018] Exercises for Chapter 1 of Mastering Go are complete. The chapter was a quick read as most of the content is not new; a couple of new things about logging but not much more. Wrote a simple program to provide the functionality of the three suggested exercises at the end of the chapter.
    Programs: floats

  • ☑ [Aug 19, 2018] Exercises for Chapter 12 of Go System Programming are complete. Wrote a chat server that echoes every message sent by a client to any other client, that is, this is a multi-echo server. Clients can use the /mute and /unmute commands to avoid/resume echoing of their messages, and the /quit command to close the connections. The chat server uses a standalone TCPServer server library which I wrote from scratch to abstract all the low-level TCP sockets details from the application. I put a special effort on writing good documentation for the chat and TCPServer programs.
    Programs: chat tcpserver

  • [Aug 06, 2018] Exercises for Chapter 11 of Go System Programming are complete. Wrote a database program to manage city information from OpenWeatherMap. The implementation uses an SQLite database and supports all CRUD operations. Additionally, the database program exports data in text, CSV, and JSON formats. Wrote a weather web server that renders city information retrieved from the database program, as well as weather forecast data retrieved in real time using the REST API from OpenWeatherMap. Forecast rendering uses Golang HTML templates.
    Programs: db weather

  • [Jul 22, 2018] Exercises for Chapter 10 of Go System Programming are complete. Modified the pipeline program to update a shared structure in a controlled way using a mutex. Modified the socket program to terminate if a timeout expires while waiting for new connections.
    Programs: sharedmem, timeout

  • [Jul 19, 2018] Exercises for Chapter 9 of Go System Programming are complete. Wrote a program where two Go routines communicate via channels. Wrote a program that uses a pipeline of channels to search for a word on multiple files, and to report the number of ocurrences.
    Programs: channels, pipeline

  • [Jul 17, 2018] Exercises for Chapter 8 of Go System Programming are complete. Updated the ddGo program to report progress when the SIGUSR1 signal is received. Wrote a program where two Go routines communicate via pipes. Wrote a program where two Go routines communicate via a Unix socket; this program also accepts multiple client connections.
    Programs: dd, pipe, socket

  • [Jul 12, 2018] Exercises for Chapter 7 of Go System Programming are complete. Wrote a program to add line numbers to a file by writing the changes to a temporary file first, and then copying over the result over the original file. Wrote a program to remove a timestamp from lines on an input file.
    Programs: insertLineNumber, rmRegexp

  • [Jul 11, 2018] Exercises for Chapter 6 of Go System Programming are complete. Improved the wc.go program by fixing and reporting bugs, and loading entire files into memory for processing.
    Programs: wc

  • [Jul 4, 2018] Exercises for Chapter 5 of Go System Programming are complete. Added command-line option to remove multiple files to the remove program, and modified the traverse program to list regular files only. Also, wrote two new programs, one with a minimum implementation of the ls command, with support for the -a and -l command line options, and another illustrating How to Retrieve File Ownership Information in Golang
    Programs: rm, traverseFile, ls, ugid

  • [Jun 24, 2018] Exercises for Chapter 4 of Go System Programming are complete. Added search value and delete node capabilities to the binary tree program. Modified the hash program to prevent duplicate values in the hash table.
    Programs: tree, hash

  • [Jun 12, 2018] Exercises for Chapter 3 of Go System Programming are complete. The reflection program iterates recursively over a structure object, describing and modifying its fields.
    Programs: reflection, ocurrences

  • [Jun 03, 2018] Exercises for Chapter 2 of Go System Programming are complete. Enhancements include dealing with stdin pipes and redirection, running unit tests, and a Makefile for Golang.
    Programs: coordinates, minmax

  • [May 26, 2018] Hello World! program complete, as per the How to Write Go Code tutorial. Code reorganized as suggested in the Golang project layout guidelines.

  • ☑ [May 19, 2018] Tour of Go tutorial goal complete. My solutions to the exercises are available from the snippets section in Gitlab.