Category: Golang Code

Foreach Loops: The Go Way

The foreach keyword itself does not exist within Go, instead the for loop can be adapted to work in the same maner. The difference however, is by using the range keyword and a for loop together. Like foreach loops in many other...

Read More

Build a Basic Web Scraper in Go

This is a single page web scraper, it uses the goquery library to parse the html and allow it to be queried easily (like jQuery). There is a Find method we can use to query for classes and ids in same way as a css selector. In...

Read More

How to Run a Single Test

Go has a simple command line for running its tests, with go test. However, often when writing tests you don’t care about the rest of the test suite – you just want to run your new test. This post shows you the...

Read More

Generate a PDF in Go

We have already covered pdf generation to some degree, by using wkhtmltopdf on AWS’ Lambda service. This post is about generating pdfs without needing wkhtml – by building the pdf from Go itself. To do this we use a...

Read More