This is part two of a two-part series of tutorials about regular expressions in Go. In part one we learned what regular expressions are, how to express them in Go, and the basics of using the Go regexp library to match text against regular expression patterns.

Continue Reading

Views: (39)
(0)

Regular expressions (AKA regex) are a formal language that defines a sequence of characters with some pattern. In the real world they can be used to solve a lot of problems with semi-structured text. You can extract the important bits and pieces from text with a lot of decorations or unrelated content. Go has a strong regex package in its standard library that lets you slice and dice text with regexes.

Continue Reading

Views: (33)
(0)

Text is all around us as software developers. Code is text, HTML is text, XNL/JSON/YAML/TOML is text, Markdown is text, CSV is text. All these text formats are designed to cater to both humans and machines. Humans should be able to read and edit textual formats with plain text editors.

Continue Reading

Views: (52)
(0)

One of the most important aspects of any application is validating its input. The most basic approach is just failing if the input doesn’t satisfy the requirements. However, in many cases this is not enough. In many systems the data collection is separate from data analysis. It could be a survey or an old dataset.

Continue Reading

Views: (63)
(0)

JSON is one of the most popular serialization formats. It is human readable, reasonably concise, and can be parsed easily by any web application using JavaScript. Go as a modern programming language has first-class support for JSON serialization in its standard library.

Continue Reading

Views: (110)
(0)

This is part five out of five in a tutorial series on testing data-intensive code. In part four, I covered remote data stores, using shared test databases, using production data snapshots, and generating your own test data. In this tutorial, I’ll go over fuzz testing, testing your cache, testing data integrity, testing idempotency, and missing data.

Continue Reading

Views: (39)
(0)

This is part three out of five in a tutorial series on testing data-intensive code with Go. In part two, I covered testing against a real in-memory data layer based on the popular SQLite. In this tutorial, I’ll go over testing against a local complex data layer that includes a relational DB and a Redis cache.

Continue Reading

Views: (42)
(0)

This is part two out of five in a tutorial series on testing data-intensive code. In part one, I covered the design of an abstract data layer that enables proper testing, how to handle errors in the data layer, how to mock data access code, and how to test against an abstract data layer. In this tutorial, I’ll go over testing against a real in-memory data layer based on the popular SQLite.

Continue Reading

Views: (46)
(0)

Many non-trivial systems are also data-intensive or data-driven. Testing the parts of the systems that are data-intensive is very different than testing code-intensive systems. First, there may be a lot of sophistication in the data layer itself, such as hybrid data stores, caching, backup, and redundancy.

Continue Reading

Views: (40)
(0)

Go couldn’t load code dynamically prior to Go 1.8. I’m a big proponent of plugin-based systems, which in many cases require loading plugins dynamically. I even considered at some point writing a plugin package based on C integration.

Continue Reading

Views: (4789)
(0)

Go has a very interesting type system. It eschews classes and inheritance in favor of interfaces and composition, but on the other hand it doesn’t have templates or generics. The way it handles collections is also unique.

Continue Reading

Views: (32)
(0)