Let’s have a look at how to split application code and configuration for your Golang app. As an example I’d like to show how to use TOML to load your database configuration.
I came to write this because I was dabbling with exporting WordPress posts to TOML front matter / hugo and needed to be able to swap out database servers for development and production servers.
Continue reading “Golang TOML Configs Example: MySQL Connection”
How to deploy an app written in Go? That’s one of the questions I had when I first wanted to get something online after playing with Go for a while. Thinking back I think the first project I got online, was probably the redirect checker which is explained in detail here: Tracing or Preventing HTTP Redirects in Golang
When you just want to get stuff running, you probably don’t want to learn a container system, but just get it out there which is exactly what we’re going to have a look at in this post.
Continue reading “Deploying your Golang App without Docker”
In this post we’ll have a look at how to build a MySQL backed API with Go and echo. This is part of the series that explains how we did photographerexcuses.com
The site is a Vue.js single page app, that gets its data (the excuses) from the Go API. We are storing the excuses in MySQL, because we can easily edit them at the same time with MySQL workbench or similar tools that don’t require flat files, git or other methods that would be more annoying to deal with.
Continue reading “Building a Go(lang) API with echo and MySQL”
This was confusing to me at first, because in basically every language I knew I could change the length of an array by just
pushing things to it. Not so; in Go.
Continue reading “Golang: Arrays of Strings”
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”
The framework I’m using is superior to yours!
discussions en masse.
I just want to give a quick overview of what I think of the matter, because many people have some good points, but my TLDR; version would be: do whatever you want, but don’t tell other people what they should do.
Continue reading “On: Too many Frameworks and if you should use one”
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”