Golang

Things to know about HTTP in Go

Go has a very strong standard library, and one of the most used parts of it is the net/http package, which provides structures that make development of HTTP servers and clients very straightforward. There are a few edge cases, where a deeper understanding of the http and related packages is very welcome.

Read more

Parsing strings with Go

Parsing strings would arguably be one of the more basic operations that one can do in any language. Sometimes, this may mean comma separated values from an user input on a web page, it may mean parsing application arguments from os.Args, or parse some line based input like lines from an IRC chat, Slack, Discord or some other chat system for a bot.

Read more

The thing about dates

Last week I started to challenge myself with #100DaysOfCode. During the week I wrote a Twitch Bot that connects to a list of twitch channels and monitors channel followers and provides some statistics like time watched. Common enough, the follower API provides the time when the user followed the channel and in order to store it to the database with Go, I wanted first to convert it to a time.Time.

Read more

The thing about slices

Slices are tricky. If you have been using Go for a while now, you may be aware that a slice is basically a triplet consisting of a:

  1. pointer to an array of values,
  2. the capacity of the array,
  3. the length of the array

This makes working with slices also a bit different than working with structs.

Read more