This tutorial assumes you have:

  • A basic understanding of Go Language
  • Latest Golang version installed on your system
  • A few minutes of your time.

In this article, we will know about environment variables and why to use them. And will access them in a Go application using inbuilt and third-party packages.

What are environment variables?

Environment variables are key-value pair on a system-wide level, and running processes can access that. These are often used to make the same program behave differently in different deployment environments like PROD, DEV, or TEST. Storing configuration in the environment is one of the principles of a twelve-factor app. It enables applications to be portable.

#go #environment variables #golang

Environment variables in Golang
2.30 GEEK