Don’t use Golang

Golang is a trend now but there is a lot of projects where you have to avoid of using it.

Let’s start from what kind of benefits brings Golang for your team/project:

– Easy to learn and get started with. This helps to grow your team quickly and involve new people even without any experience with Golang.

– Built-in concurrency and a robust standard library. Which allows to utilise your CPU in the most effective way and easily create multithreading applications (channels, mutex, atomic etc.).

– Strict types helps to avoid some basic coding issues. So these options shows us that Golang is a good tool for high performance projects and big growing teams.

But otherwise when your team is small and you don’t need to solve high performance tasks. That means that you will have some troubles like a very big codebase.

– Lack of generics in Golang will make you to write / support more code.

– Writing of multithreading programms even in Golang requires to have senior engineers. So that means you will have to spend more money on your team without any incomes from using Golang.

– It will take more time to release because you will need to write/support a bigger codebase.

When you don’t need to use Golang in your team/project?

– Your project is not simple (it is not quite small like some CLI utilities or small service) and it should be build as a monolithic application with a small team

– Your budget is not big and you don’t have too much time for release

– Your project is new and you have to release it ASAP to make money

– You don’t have any high performance problems which can not be solved on your current technical stack

Presenting Go-Up

Today I have started development of new package for Golang-developers – Go-Up. I made it because I have noticed that I should repeat some things with each new project on Golang, so the main purpose of Go-Up package is to simplify building of new Golang applications.

This is a beginning so I just want to share link to GitHub here –

Golang: пакеты

По поводу пакетов в голанге есть множество статей и ресурсов, например – Но лично у меня в самом начале изучения этого языка прграммирования возникли две проблемы:

  1. Как использовать пакеты внутри совего приложения для разделения кода(что-то вроде namespace в других языках);
  2. Ошибка цикличного импорта пакетов.

Первый вопрос снимается легко, допустим у нас в проекте с названием project7(директория /go/src/project7) есть модели и контроллеры в соответствующих директориях(models и controllers), тогда мы можем их использовать в нашем главном файле main.go вот так:

То есть, по сути мы просто используем их как локальный неймспейс, все очень просто.

Проблема циклических импортов возникает, когда вы ипортируете пакет, который импортирует пакет из которого вы производите импорт.

Т.е. получается, что вы попадаете в бесконечный цикл импорта, так как оба пакета импортируют друг друга.

Избежать этой проблемы легко – используйте интерфейсы.