Serving Single-Page Applications in Go

Someone may ask what is so special about serving single-page applications? Well, if you use hash (#) based URL’s like <em>https://yourdomain.com/#/yourroute</em> , there is no problem because browser recognize that this is a default page with some parameters and doesn’t make another request to the server. However, if you want to use non-hash based routes, there is a problem if you try to refresh a non-default route. In this case browser’s default action is to load such URL from the server and there is no such document on the server....

2020-05-03 · 3 min · Boban Acimovic

Generators, wait groups and closures in Golang

This is the first step of my intention to write a series of articles where I would explain some common patterns used in Golang. Let’s start with generator pattern : 1type Generator func() <-chan int Generator is a function or method which returns a sequence of values. In Golang, this usually means returning a channel of values of desired type. In our example, we will return a channel of integers. Let’s see an implementation of this:...

2019-10-04 · 5 min · Boban Acimovic

Install Golang package on Ubuntu Linux

Official Golang documentation contains just tar.gz package to be downloaded and installed on Ubuntu Linux, but this is not quite comfortable way because Golang won’t be automatically updated after new release. Fortunatelly, there is trustable PPA that can be used. 1 2 3 sudo add-apt-repository ppa:longsleep/golang-backports sudo apt-get update sudo apt-get install golang-go

2019-10-03 · 1 min · Boban Acimovic

New kind on the Block

Few months ago I wrote an article about replacing Minikube with MicroK8s , but now we have even better soluion, kind . Like dind allows running Docker inside Docker containers, kind allows running Kubernetes inside Docker containers. kind basically abstracts nodes as Docker containers and then runs Kubernetes inside. After you install Golang , it is quite easy to install and setup kind: 1 2 GO111MODULE="on" go get sigs.k8s.io/kind@v0.5.1 kind create cluster After some 30 seconds your single node cluster will be ready for development and testing....

2019-10-03 · 1 min · Boban Acimovic