DEV Community

Cover image for Top 5 Tips for Your First Golang Project
jones268
jones268

Posted on

Top 5 Tips for Your First Golang Project

#go

Golang aims to be "Fast, Concise, and Effective". The language promises a turn-key environment for those just getting started with the language, yet still provides support for those who want to write their own tools or delve deeper into the architecture.

Much like other popular languages such as C/C++ and Java, Golang supports memory management (GC) and offers suitable support for concurrency and multi-core systems.

  • Pick your editor wisely

Golang is a compiled language, unlike PHP, Ruby, or Javascript, where the source code is converted to machine code on the fly every time the server runs. Because of this, an editor that has support for Golang syntax makes a big difference.

  • Use gofmt

If you are new to Golang, you want to use the gofmt tool while writing your code. This ensures that your code is formatted consistently and makes it easier for other developers to read it and contribute to your project.

  • Create a project readme

You might want to create a quick document (README) which describes how to build and install your project. In addition to this, you can add any extra information which will be helpful for developers using the project.

  • Dependencies

Always define your dependencies not only in the package management file (i.e. Godeps file) but also in the source code itself. This allows you to find all usages of external packages very easily.

  • Command line flags

If you have command line flags which users might want to customize, then create separate functions for each of them.

Top comments (0)