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.
Tags# , ,

Golang: Extending reflect.StructTag to support duplicates

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.
Tags# , , ,

Design Patterns in Golang: Decorator

Introduction The Decorator pattern adds new functionality to an existing object without altering its structure. It is a structural pattern as this pattern acts as a wrapper to existing class. The instanciate a decorator struct which decorates (wraps) the original object and provides additional functionality keeping its methods signature intact. Purpose Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to inheritance for extending functionality. Wrapping a present, putting it in a box, and wrapping the box.

Design Patterns in Golang: Composite

Introduction A Composite Design Pattern is a structural pattern that uses to employ composition when implementing an interface rather than using multiple inheritance. It composes objects into tree structures and lets clients treat individual objects and compositions uniformly. There are situations when clients ignore the difference between compositions of objects and individual objects. If dealing with multiple objects in the same way as handle each of deam is identical, the Composite Design pattern is a good choice to decrease the complexity and treat them as homogeneous.

Desing Patterns in Golang: Bridge

Introduction The Bridge Pattern is a creational design pattern used to decouple an abstraction from its implementation. The bridge uses encapsulation, aggregation, and can use inheritance to separate responsibilities into different classes. Purpose Decouple an abstraction from its implementation that allows both to vary independently. Publish interface in an inheritance hierarchy, and bury implementation in its own inheritance hierarchy. Design Pattern Diagram The objects participating in this pattern are presented on the following diagram: