In this post we’re going to have a look at how to have a close look at HTTP requests processed by Go and how to prevent automatic redirection through
302 or similar redirects. This is useful both for investigating tracking links from twitter, buffer, bit.ly or email marketing, or to make sure your tools to generate them actually work 😉 For a demo, check out the Redirect Checker Tool
Continue reading “Tracing or Preventing HTTP Redirects in Golang”
Web scraping is practically parsing the HTML output of a website and taking the parts you want to use for something. In theory, that’s a big part of how Google works as a search engine. It goes to every web page it can find and stores a copy locally.
For this tutorial, you should have go installed and ready to go, as in, your
$GOPATH set and the required compiler installed.
Continue reading “Web Scraping with Golang and goQuery”
Checkup is a siteuptime like alternative that will monitor the response times of your website and a bunch of other things.
Setting up the project is a little tricky if you’re new to go, but if you read the Readme and google the error messages you get, you should be perfectly fine.
You can clone the most recent version from their github repository and run it with:
go run cmd/checkup/main.go --store
Using the checkup fs provider
Sadly the documentation is not super awesome yet, but I quickly diffed the changes I made to make the project use the local storage provider instead of relying on aws s3.
Continue reading “Using Sourcegraph Checkup with local file system storage”
Since I’ve recently started dabbling with Go again, of course I had to install it on my machines that mostly run Linux Mint. One of the usual ways for me to install software through the PPAs was apparently not maintained since a couple of releases ago, but on a ubuntu forum thread I found godeb, which is a small binary command line tool that lets you install your desired version of Go!
Continue reading “Installing Go on Ubuntu / Debian / Linux Mint with godeb”
Parsing JSON is a common task for most developers, currently I’m actually finally getting to write slugofy which is supposed to slugify URLs or URL fragments in Go.
In case you’re wondering, slugs are commonly used to generate URLs from the title of a page. Let’s say we have a page title like the Swedish national dish:
Swedish national dish: köttbullar, we probably don’t want either the special chars like the ö or the : in there. Also we don’t want whitespaces to show up as
%20, so let’s make them dashes instead:
Continue reading “JSON parsing in Golang”
Unit testing with Go-lang is very simple and the
testing library is actually included by default. For test driven development or just for covering the functionality of your code afterwards, unit tests are pretty essential.
This article is about the smallest possible effort we can make to get started with testing. No fancy algorithms or too language specific things, just the bare minimum, so we understand what’s going on and can extend from there on.
Continue reading “Go(lang) Unit Testing for Absolute Beginners”
Go is a C-like language and initially developed at Google, it has caught my attention by some members of the node.js and web development community giving it a shot and also some interesting looking projects. You can check it out at golang.org. Continue reading “Taking a stab at the Go Language and file permissions”