Category: Golang Code

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

Read a File to String

This is a matching post to “Writing to a File” and explains how to simply get the contents of a file as text and print it to screen. There are different ways to achieve this in Go – all valid. In this guide...

Read More

Working with POST Request Data

This is an overview post (pun intended) about how to work with post request data sent to an endpoint via HTTP. This is slightly different to data stored in query parameters sent in the url and has to be handled differently....

Read More
Loading

Follow Us on Twitter