Passion. Creativity. Courage. Technology.

The official phogo journal

File System notifications with Golang

The [fsnotify]() is the most broadly used package for observing file changes. It supports multiple platforms and notification mechanisms: inotify (Linux) kqueue (BSD, MacOS, iOS) ReadDirectoryChangesW (Windows) Installation go get -u go get -u Usage The package itself is very minimalistic but provides the great benefit of observing file for changes. To get started, you have to initialize the watcher and register for monitoring the desired file path (can be file or directory): read more

Working with FTP protocol in Golang

One of the benefits of using Golang is its http package that provides an easy way to build robust REST APIs. Unfortunately, it does not provide out of the box away to build FTP server or connect to FTP server. In this article, we will explore that by demonstrating the usage of two third party packages that allow that. Connecting to FTP server The most robust and broadly used package that provides an FTP client build by Julien. read more

Extending reflect.StructTag in Golang

Presently, Golang has limited support of reflection comparing to the mainstream languages like C# and JAVA. It’s not intended to match or beat that languages. In practice, we are using StructTag to add some metadata for the defined struct fields. Such an example is json package, where you can customize the field marshaling. In example below, we customize the json representation of User struct fields: type User struct { ID string `json:"id"` Name string `json:"name"` CreatedAt time. read more

Chicago Classical School vs London Mockist School

In the practice of modern TDD two main schools of thoughts among TDD gurus have emerged. Let’s start by comparing the differing characteristics of each practice and present the key proponents of each approach. As a first oversimplification, we can broadly describe “classical TDD” as “bottom-up” and “london mockist” as top-down, as the name suggests mockist school relies on mock objects (actually doubles but who cares?) to test interactions on the unit level. read more