How to use Makefiles for your Golang development

Leo Gutiérrez
3 min readDec 20, 2020

Hello, in this little post I would like to show you how you can use Makefiles to ease the development of your Golang programs.

“go <command>s” are great by themselves, you can basically manage every part of your Golant development phase with Go’s native tools, so why would I want to use something else? This is a fair question. In many cases I have had the necessity of sharing my codebases or repositories with someone that is not familiar with Golang itself, they won’t know how to build it. Of course you can attack that problem with some documentation in your README.md or some other files specifying how to build your program. A makefile is a great way of abstracting the technical details for someone that just want to try to build our program quickly, in an agnostic way. At the exact moment I see that there is a “Makefile”, I immediately know that there is something I can build with make and optionally with make install.

I don’t remember that long command / I don’t want to type that long command

They are specially useful when you want to reduce your typing or you just want to avoid typos.

Instead of typing this:

go build -o myprogram
./myprogram

--

--

Leo Gutiérrez
Leo Gutiérrez

Written by Leo Gutiérrez

Hi! I am Leonardo Gutiérrez R., a passionate software developer, I hope you find the content in this blog interesting. I write about IT related stuff.