Add a Watermark to the image with image go package · · Go
Go is very rich for packages support. But I also can say that Go is a perfect language to write almost everything with help of
stdlib only. At Weelco we are generating some images with watermarks in Go, and we are using only
Use Go Fonts in Atom · · Go Atom
Just a few days ago Go team has announced Go font called “Go Mono”. Go source code looks good when displayed in Go Mono. Also go fonts are licensed under the same open source license as the rest Go projects have.
Here is an example how it looks in my Atom.
Perfect func main() · · Go
It’s the only one function all Go commands must have. You may say that everyone’s
main() function is different, depends on a project. But let’s think about reusability and testability.
main() function cannot be tested in a good way, also it cannot be imported and used in another go project. So all you code you put into it isn’t reusable/testable.
Swaggerize your APIs · · Go Swaggger
Swagger UI is a great tool and a must have for any respectable API project. It has an intuitive design, all endpoints can be tested from the interface. For example, let’s have a look at Kubernetes API, where endpoints are grouped by version, and everything is accessible in easy way. In this post I’ll show how to build it together with your API written in Go.Read more
Golang Docker Skeleton · · Go Docker
I really like templates and standards in the companies or a single team. Of course each company has it’s own application layout, because it depends on tools, people and goals. Also everyone wants to save a time. In the SOA century we have to create new projects, repositories more often and often, create
Dockerfile again, think about layout, write a documentation. In this post I want to share my template created for Go applications that work in Docker, which I am using in my projects.
Memory leaks with mux.Router in Go · · Go Memory Profiling
Today we found that our web server written in Go has memory leaks and consume around 300M of memory, which is really a lot for our app. After restart it’s back to ~10M but each hour increased by few more. Golang has nice built-in tools to debug and find leaks.Read more
Go templates. Helper to render a struct · · Go
The Go language comes with a powerful built-in template engine. In Go, we have the template package to help handle templates. We can use functions like
Execute to load templates from plain text or files, then evaluate the dynamic parts. Also it’s possible to create user-defined functions and call it from templates.
UUID without dependencies in Go · · Go glide
Today I realized that size of my
vendor/ folder in Golang project is around 150M. I am using
glide there. There are 24 dependencies (it’s a program with multiple data storage connectors, notifications, etc.), so I decided to review it and reduce amount of 3rd party libraries.
First of all I have checked
glide-report and removed 2 unused packages. Go-world has a lot of packages that are awesome and can save your time, but not your program’s performance. I found few packages which I am using as helpers. For example gouuid.
Concurrency. Data race · · Go Concurrency
What does data race mean in Golang? Data race is a common mistake in concurrent systems. A data race occurs when two goroutines access the same variable concurrently and at least one of the accesses is a write. It’s really hard to recognize it without specific tools or without an eagle eye, because when you run a program it’s always a chance that you won’t see your mistake or it will be very transparent.Read more
Working with ClickHouse in Go. Part 1: Basics · · Go ClickHouse
ClickHouse is an open-source column-oriented database management system that allows generating analytical data reports in real time. Created by Yandex developers for internal purposes, but then has migrated as open-source tool. It currently powers Yandex.Metrica, world’s second largest web analytics platform, with over 13 trillion database records and over 20 billion events a day, generating customized reports on-the-fly, directly from non-aggregated data. So it is really fast.Read more