Go Programming Language Packages


The Go standard library have several packages available for gophers to address the various programming-related issues which they encounter frequently. Besides, the core packages, there are also some third-party packages, which are quite useful for gophers. Moreover, most of these packages are open-source and free for usage. So, let us check out some important third-party Go packages which are useful for gopher working on various projects. The list contains popular Go packages for validations, JSON/XML/HTML parsing, Statistical calculation and more. Simple examples are also provided for some of them.


Go Struct and Field Validation Examples

Package validator implements value validations for structs and individual fields based on tags. It has the following unique features for Cross Field and Cross Struct validations by using validation tags or custom validators. Slice, Array and Map diving, which allows any or all levels of a multidimensional field to be validated. Ability to dive into both map keys and values for validation.

Example Explained


Dynamic JSON in Golang

Gabs is a small utility for dealing with dynamic or unknown JSON structures in Go. It does not require you to know the structure of the payload (eg. create structs), and allows accessing fields by providing the path to them. It's pretty much just a helpful wrapper for navigating hierarchies of map[string]interface{} objects provided by the encoding/json package. It does nothing spectacular apart from being fabulous.

Example Explained


Golang Statistics Package

This package provides functions for calculating mathematical statistics of numeric data. You can use it even if your datasets are too large. This package can't rely on importing other modules or packages or libraries. You can get commonly used statistical functions like Mean, Median, StandardDeviation, Variance, Correlation, HarmonicMean and so on..

Example Explained


Go Slice Map Filter

A modern Go utility library which provides helper functions. This helper functions can solved common problems like removes all duplicates within a slice, get the difference between two collections, fills elements of array with a value, get the intersection between two collections and so on.. This package uses reflect to make the interface on the consumer as easy and flexible as possible.

Example Explained


Golang HTML parser

Package goquery implements features similar to jQuery, including the chainable syntax, to manipulate and query an HTML document.

It brings a syntax and a set of features similar to jQuery to the Go language. It is based on Go's net/html package and the CSS Selector library cascadia. Syntax-wise, it is as close as possible to jQuery, with the same method names when possible, and that warm and fuzzy chainable interface.

Example Explained


CommonRegex Golang Package with examples

This is a collection of often used regular expressions. It provides these as simple functions for getting the matched strings corresponding to specific patterns. This helps to find all times, dates, links, phone numbers, emails, ip addresses, prices, hex colors, and credit card numbers in a string. Package developer's did the hard work so we don't have to.

Example Explained


Simple image processing package for Go

Package imaging provides basic image processing functions (resize, rotate, crop, brightness/contrast adjustments, etc.). All the image processing functions provided by the package accept any image type that implements image.Image interface as an input, and return a new image of *image.NRGBA type (32bit RGBA colors, non-premultiplied alpha).

Example Explained


Golang Chart Package

Package chart is a very simple golang native charting library that supports timeseries and continuous line charts.

Example Explained


Golang dynamic XML parser

xmlquery is an XPath query package for XML document, lets you extract data or evaluate from XML documents by an XPath expression.

Example Explained


Golang Data time toolkit

Now is a very simple package that provides a convenience wrapper for the standard time package and makes it easy to work with various date and time constructs around the current time.

Example Explained