Jan-Lukas Else

Tech, life and everything else

Tags: Go


Use Telegram as a notification service with Go

Published on in 👨‍💻 Dev

Telegram is my favorite messenger for chatting. There are many reasons for this. But Telegram is also very suitable to use it as a notification service for your own projects. For example I get a daily overview of the number of page views of my blogs, but also notifications about new Webmentions, or likes and announcements via ActivityPub are sent to me via Telegram.

View

Published on in 💬 Micro

It seems like I’m currently a bit obsessed with creating new Go-based projects. Yesterday, I announced my new Telegram channel, where it’s possible to receive notifications about new entries on my blog (I created another channel for the German posts too). First, I tried to use IFTTT, but somehow IFTTT’s behavior is a bit unpredictable and I thought it’s probably easier to just code my own solution. It was only a task of about an hour, but now it works the way I want it to work. To trigger updates on the Telegram channel, I configured my blog build pipeline (I use Drone CI to build and publish my blog) to always make a webhook request to my new tool after the updated site got deployed to the server. I have to say that the Telegram Bot API is a really nice and simple API. Sending a message is done with just a single HTTP call. Although there are a couple of libraries that can do that too, I noticed it’s easier to just write some simple code for the request myself.

View

Published on in 💬 Micro

What I like about Go: It’s quick and easy to create small programs, including support for Docker and everything. For example, today I developed a minimal URL shortener that stores the entries in a SQLite database: https://jlel.se/goshort

Now I have finally found a good use for the domain I recently registered. 😄

View

Published on in 💬 Micro

I admit it is the first time I am writing code that is almost 100% covered by unit tests. But it’s such a good feeling to have small, concise methods whose functionality you can rely on. Even before I have a running application, I know that what is already written will work. And unit testing with Go is really fun.

View

Writing a SQL database from scratch in Go

Published on in 🔗 Links

Phil Eaton wrote a really cool article. He documented how he used Go to write a rudimentary SQL database including a CLI. It is very interesting to read how commands are parsed and analyzed. The whole thing probably has no practical use (there are already countless mature database systems), but it’s still exciting. I remembered some of the math lectures in the first semester about formal languages.

View

Published on in 💬 Micro

Yes there is a microformats library for Go. Will Norris also made the webmention library, which I’m using in my custom Hugo backend. I’m not saying it’s not possible to parse and display webmentions, I’m just trying to keep things simple. 😊 Everything is possible!

View

Refactoring

Published on in 💬 Micro

I wrote about my Indieweb dream this morning. To come closer to this dream and to clean up some code, I started refactoring my hugo backend code. I made use of Go interfaces to later be able to easily add more storage, CDN or social network providers. It also made the code a bit cleaner and a bit more modular, but there’s still a lot of learning and work to do. What I still struggle with though is testing: I don’t have any automatic tests yet. How do I test HTTP calls to external APIs?

View

Go and Java

Published on in 💭 Thoughts
Updated on

While I need to use Java for university projects (currently that are one Spring and one Java EE project) and work, I use Go on some personal projects (Hugo backend and KISSS). While I’m getting more familiar with Go (I do Java for many years), I also experience cases where I actually miss language features from Java. Oh and it’s not generics, I’m currently (still) fine without generics.

View

The Value in Go’s Simplicity

Published on in 🔗 Links

Benjaming Congdon shares in an article, why he appreciates Go’s simplicity. To summarize: Its great forward / backward compatibility, dependencies (stable, fewer dependencies needed), included functionality (testing, http, …) and formatting (because Go has an integrated formatter, although every project has its own way to do things, all code follows the same formatting conventions).

View

Happy Birthday, Go!

Published on in 🔗 Links

I develop code in Go for just a few months now, but I learned to like it. It’s fast, simple and can produce static binaries. In contrast to Java (the language I have to use for a lot of university and work stuff) it does many things much simpler. And I think Go is really easy to learn, also thanks to its good documentation.

View

Jan-Lukas Else