Notes on Go Development

Page content

Notes on developing software with the Go language.

Installing Go

To install Go on Windows, download it from the official Website. Choose the 64-bit Windows installer package for the current version, unless you know that you need a different option.

To install Go on macOS or Linux, use Homebrew. Linux distributions supply versions of Go, but these will frequently be older than the current release.

Docker, Inc. maintain Docker images for Go. These are useful for Continuous Integration, where you need containers that include a Go compiler to build releases of your software.

Essential Tools

The Go Plugin for Your Code Editor

If you use Visual Studio Code, install the Microsoft plugin for Go. Use the vim-go plugin for Vim. If you would prefer to use an IDE, JetBrains offer GoLand as a commercial product.

Code Quality

staticcheck is the most popular code linter for Go. The Visual Studio Code extension for Go will install and use staticcheck.

Use golangci-lint to run a suite of quality checks on your code, including staticcheck rules. This tool works with popular code editors and IDEs. You should also add golangci-lint to your Continuous Integration process, to ensure that the code that is submitted passes quality checks.

The Go Report Card service analyses the Go software in public Git repositories, using some of the standard quality checks. You do not need to do anything to enable the service to analyse your project. If you wish, you may add a badge to the README in your repository that links to the Report Card for your project.


The Go standard library includes tools for testing. You may want to enhance your tests with these libraries:

Other Important Tools

  • Delve - Debugger
  • goimports - Removes unused import statements from Go code
  • GoReleaser - Release automation for Go projects

Web Applications

You can develop Web applications in Go with just the standard library and a few third-party packages, but you will need to handle many features and technical decisions yourself. These frameworks provide conventions and sets of tested components for your applications:

  • Echo - A small, convenient framework for Web applications
  • chi - A minimal router and middleware framework for Web API services.
  • Go kit - Microservices in enterprise architectures

Consider using oapi-codegen to generate Go code from OpenAPI specification files, rather than writing your own server code. This tool works with both Echo and chi.

Go Web applications can be deployed on a very wide variety of infrastructure. Cloud services such as Google App Engine, Heroku and Red Hat OpenShift provide low-maintenance hosting, but you can set up any server to run Go applications.

To produce applications for AWS Lambda, use the Serverless Framework or AWS SAM.

Static Websites

Use Hugo to build static Websites.

Web Clients

The standard library for Go includes HTTP server and client software. Consider using oapi-codegen to generate Go code from OpenAPI specification files, rather than writing your own code for Web clients.

The goquery library provides an implementation of the jQuery API for HTML parsing. Colly is a complete framework for Web scraping.

Developing Command-line Tools

The Go standard library includes the basic elements that you need to build your own command-line tools. Use the Cobra framework to create command-line tools with features such as sub-commands and autocompletion.

Internet of Things

Use TinyGo to run Go on microcontrollers, such as Arduino boards.

Gobot enables you to develop Go applications that work with robotics.

Developing Desktop Applications

The Wails and Fyne projects provide tools for developing desktop applications with Go.

Developing Games

Ebitengine is a 2D game engine for Go.

Working with Databases

Go includes support for SQL in the standard library. The database/sql package provides the basic components that are needed for database access. You can use it in your own applications, but it is most valuable for the authors of libraries. In most cases, you should use a third-party library to work with SQL databases. In either case, you will need to install the appropriate driver for the database.

Data Access with SQL

These libraries offer different approaches to SQL data access:

  • sqlx - A convenient data access API that follows the conventions of the Go standard library
  • sqlboiler - A tool that generates full sets of Go data access code for existing databases
  • sqlc - A tool that generates Go data access code from specified SQL queries
  • Ent - Object Relational Mapper that supports advanced use cases

Migrations for SQL Databases

These projects manage schema migrations for SQL databases.

Goose can either be used as separate command-line tool, or integrated into your Go project.

Atlas is provided as a command-line tool, but it is also used by the Ent ORM.

Drivers for SQL Databases

The drivers for popular databases are:

Embedding a Database

You can include a database feature in your Go application, rather than relying on a separate service.

SQLite for Go provides the equivalent of a current version of SQLite, but it is a pure Go library with no dependencies on C code.

If a SQL database is not appropriate, consider using bbolt. This package implements a file-based key-value database system in Go.

Data Types

  • decimal - Decimal support for Go
  • gonum - Packages for numeric and scientific work
  • uuid

Data Formats

Other Useful Libraries

  • go-git - Implementation of Git in Go
  • ozzo-validation - Validations, based on functions
  • validator - Validations, defined using struct tags
  • Viper - Configuration for Go applications
  • Watermill - Library for event-driven applications
  • zerolog - Structured logging for Go applications