Why I created “generator-yogo” and make my life easiest

Hello all and let’s start history. I am software developer in ricardo.ch. My experience it’s different software languages as GO, NodeJs, Java, C# and etc. But most of time it’s GO (microservices). First 5 microservices it was really big fun for me. But after I found a lot of duplication work.

As example :

  • .gitignore, Dockerfile, docker-compose, Makefile
  • Readme.md - as basic documentation
  • glide.yaml or Gopkg.yml - depends package management tools
  • config pkg (for reading ENV variables)
  • logger, Zipkin, endpoint pkgs
  • continuous integration files
  • etc

All of files and folders I am creating each time, it’s prelude before start doing something interesting. So my real process looks

main goal what i wanted to get at the end.

Benefits from this

  • avoid duplication work
  • decrease time for creating new skeleton of project
  • provide basic logic to run and test
  • avoid copy&paste process

Searching solution

So compare with Microsoft IDE. As developer you can choose and create different type of project. In most of IDE for Golang what I tried (Atom, Golang, MVS code, Sublime, etc) and didn‘t found similar things. I asked a lot of questions my best friend google :) . So i have found generator which was really good candidate (Yeoman) for base layer of Golang templates. After big motivation and several evenings. it was born YoGo generator.

What YoGo can do ???

So in first version, you can create basic “Hello world” app and REST API microservice. Specially for REST API project. As developer you can choose different dependency management tools (go dep or glide). As advanced YoGo can generate new package in already existed project. In current version it’s possible to create config or new endpoint packages

Preparation for Usage

  • Install yeoman on your system
npm install -g yo
  • Install generator-yogo
npm install generator-yogo
  • Launch the generator
yo yogo

if all steps were done correctly you should see

Follow questions what YoGo generator will ask. Last step you can find detail options how to run your service and test.

Attention

  • YoGo generator will only generate the directory hierarchy in *$GOPATH/src*.
  • Before to run your service, add on your local system new ENV variable ENVIRONMENT = DEV

How to generate new package by YoGo

In your terminal execute command

yo yogo:pkgg

and you need to see , in list of packages you can choose one of them

Future

Big plan it’s provide additional type of project like

  • Go-Kit api project and package
  • KAFKA producer
  • KAFKA consumer
  • etc.

References

Сonclusion

This project was done, just to make help during developing process. I hope it was interesting for you. And if you have any ideas how it’s possible to improve, feel free and write to us.