Go: best practices for production environments

  • Use a single, global GOPATH for your development environments. Try cloning your repos into their canonical paths within the GOPATH, and work there directly.
  • For repository structures, a good practice is to limit the number of source files. Your repos (with the exception of a vendor subdirectory) shouldn’t contain a directory named src, or represent their own GOPATH.
  • When it comes to passing configuration, package flag provides the best value and has strict typing and simple semantics.
  • Formatted code can significantly increase clarity. Use gofmt to format your code.
  • For logging and telemetry, try using package log that implements a simple logging package. It defines a type, logger, with methods for formatting output.

Full post here, 11 mins read