Posts

Deploying Telegram Bot to AWS Lambda with Function URL

This article is a continuation of “Building an AI Telegram Bot with Go, Gemini API, and AWS Lambda” and contains detailed instructions for setting up and deploying a Telegram bot to AWS Lambda using Function URL.

Building an AI Telegram Bot with Go, Gemini API, and AWS Lambda

In this article, we’ll explore how to build an intelligent Telegram bot using Go that acts as a proxy between users and Google’s Gemini API. The bot will handle two primary functions: answering user messages and generating images. While this mechanism can be significantly extended with additional capabilities like voice and video generation, we’ll focus on these two request types for simplicity.

Remote debugging with Delve

Previously we discussed local debugging with GoLand IDE. Now we’ll discuss how to remotely debug a program running inside a Docker container using Visual Studio Code and GoLand IDE.

Deploy docker swarm from Gitlab CI

Docker container deployment has many advantages over binary deployment. Let’s dive into advantages and see how we can implement docker container deployment from Gitlab CI. Let’s talk about how standard docker can help us. Any docker orchestration tools (Kubernetes, for example) will be observed in future articles.

net-wait-go utility / library

Both utility and Go package to wait for ports to open (TCP, UDP).

Building Minimal Docker Images for Go Applications

Let’s discuss how to build a minimal Docker image for a Go program.

Compilation and deploy via SSH in Gitlab CI

Let’s take a look at how Go compilation works and how to use GitLab CI for that.

HTTP

All examples from the article are located in the github repository.

Let’s take a look at HTTP tools in GO.

sync.Map

Let’s take a look at sync.Map usage and its source code.

Profiling Go: Basics and Practice

Go has rich profiling tools from the very beginning — the pprof package and go tool pprof. Let’s discuss why profiling is useful, how to work with it, and what’s new in this area.

Dependency injection in GO

Let’s talk about dependency injection pattern and dependency management in large programs.

GO Templates: Principles and Usage

Packages text/template and html/template are part of the Go standard library. Go templates are used in many Go-programmed software — Docker, Kubernetes, Helm. Many third-party libraries are integrated with Go templates, for example Echo. Knowing Go template syntax is very useful.

This article consists of text/template package documentation and a couple of author’s solutions. After describing Go template syntax, we’ll dive into text/template and html/template sources.

Filtering by a list of values with GORM

When you need to filter data by a list of values (for example, IDs: 1, 2, 3), you should use the ANY operator combined with pq.Array from the PostgreSQL driver.

Principles of slice type in GO

The Go blog describes how to use slices. Let’s take a look at slice internals.

Data handling in concurrent programs

In Go, we have goroutines functionality out of the box. We can run code in parallel. However, in our parallel running code we can work with shared variables, and it is not clear how exactly Go handles such situations.

Principles of map type in GO

The map programming interface in Go is described in the Go blog. We just need to recall that a map is a key-value storage and it should retrieve values by key as fast as possible.

Coding a Simple TCP Chat in Go

An example of a simple TCP chat in Go with logic explanation.

Golang regexp: matching newline

Why regular expressions with dot (".") work differently in Go compared to PHP and JavaScript.

GORM: filter entity by linked entity

This task is not that simple, especially with GORM.

Why and how to use a debugger with Go

A debugger is a very helpful and powerful tool. It can help you understand exactly what is happening in your code, explore new projects, and avoid unnecessary debug code changes.