Appendix Appendix. Good Practices for a Stable Go Environment

Writing Go code is a fun and enjoyable experience, where compile-time errors rather than being a pain actually guide you to write robust, high-quality code. However, every now and then, you will encounter environmental issues that start to get in the way and break your flow. While you can usually resolve these issues after some searching and a little tweaking, setting up your development environment correctly goes a long way in reducing problems, allowing you to focus on building useful applications.

In this chapter, we are going to install Go from scratch on a new machine and discuss some of the environmental options we have and the impact they might have in the future. We will also consider how collaboration might influence some of our decisions as well as what impact open sourcing our packages might have.

Specifically, we are going to:

  • Install Go on your development machine
  • Learn what the GOPATH environment variable is for and discuss a sensible approach for its use
  • Learn about the Go tools and how to use them to keep the quality of our code high
  • Learn how to use a tool to automatically manage our imports
  • Think about on save operations for our .go files and how we can integrate the Go tools as part of our daily development
  • Look at some popular code editor options to write Go code

Installing Go

The best way to install Go is to use one of the many installers available online at https://golang.org/dl/. Go to the Go website and click on Download, and then look for the latest 1.x version for your computer. The Featured downloads section at the top of the page contains links to the most popular versions, so yours will probably be in that list.

The code in this book has been tested with Go 1.7, but any 1.x release will work. For future versions of Go (2.0 and higher), you may need to tweak the code as major version releases may well contain breaking changes.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.122.11