Category Archives: golang

Go library for creating slack bots

You can use it like that:

https://github.com/shomali11/slacker

How to work with core dumps of Go programs

If you want to check what is going on in your service during load (on production or during stress testing process), you can take a core dump of your app and load it into Goland for further debugging.

Then open it your Goland: Navigate to Run | Open Core Dump. In the Executable field, …

Read more

Nice introductory article on why Golang is not OOP

It is a copy of this article — https://rakyll.org/typesystem/ It is real struggle to work with a new language, especially if the type doesn’t resemble what you have previously seen. I have been there with Go and lost my interest in the language when it first came out due to the reason I was pretending …

Read more

A way to test http client in go

A couple of ways are described here — http://hassansin.github.io/Unit-Testing-http-client-in-Go The way I liked is the following one:

Go internals

Channels https://youtu.be/KBZlN0izeiY Go scheduler https://youtu.be/YHRO5WQGh0k

Setup local Athens for proper go mod

There is a project called Athens for proxying all your go mod downloads. How to use it locally. 1. Create the following files and directories: a. /Users/d.bolgov/.ssh-athens/storage — empty directory to cache go modules b. /Users/d.bolgov/.ssh-athens/.netrc — if you prefer using .netrc

c. /Users/d.bolgov/.ssh-athens/gitconfig/.gitconfig — if you want to substitue some urls. I personally …

Read more

Installing protobuf tools on MacOS

Installing protoc

Or follow different instructions. Installing grpc_cli Option 1. Easy way.

It is described here — https://github.com/grpc/homebrew-grpc. Option 2. Hard way — using cmake and make. NOT RECOMMENDED.

Or follow these instructions

Nice talk about concurrency in Go

Another good talk. It’s not only about channels, but also about atomics and patterns around ti. https://www.youtube.com/watch?v=YEKjSzIwAdA

Make your bot for telegram using go

It’s really not that difficult. Here are the docs: https://core.telegram.org/bots https://core.telegram.org/bots/api Here is a simple library in go for telegram — https://github.com/go-telegram-bot-api/telegram-bot-api/ (too simple, from my point of view, does not cover all functionality, but okay). And here is a skeletton for making your bots if you want it as just standalone binary — https://github.com/nezorflame/example-telegram-bot/

Gitlab-ci: build go app with docker as a docker image

Preparations [TO BE UPDATED LATER] My gitlab-ci.yml

My Dockerfile

Pulling from your private registry Create deploy token as described here. After that, you can do this:

Useful links: https://dev.to/hypnoglow/how-to-make-friends-with-golang-docker-and-gitlab-ci-4bil https://docs.gitlab.com/ee/ci/docker/using_docker_build.html https://medium.com/@tonistiigi/advanced-multi-stage-build-patterns-6f741b852fae https://docs.gitlab.com/ee/ci/yaml/ (full description of gitlab-ci.yml) https://about.gitlab.com/blog/2017/11/27/go-tools-and-gitlab-how-to-do-continuous-integration-like-a-boss/ https://gitlab.com/hypnoglow/example-go-docker-gitlab/blob/master/.gitlab-ci.yml Somewhat useful: https://blog.lwolf.org/post/how-to-build-tiny-golang-docker-images-with-gitlab-ci/ https://angristan.xyz/build-push-docker-images-gitlab-ci/ https://docs.gitlab.com/ee/user/packages/container_registry/#use-images-from-gitlab-container-registry https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-centos-7 (it says to do sudo usermod -aG docker …

Read more