How to get an environment variable in Go?

In Go lang, how to get an environment variable?

asked Mar 17, 2017 by anonymous

1 Answer

To get an environment variable (e.g. "VAR") in GO:

import "os"
import "fmt"

fmt.Println("VAR:", os.Getenv("VAR"))
answered Mar 30, 2017 by zma (380 points)

Please log in or register to answer this question.

Related questions

1 answer
1 answer
0 answers
1 answer
1 answer
1 answer
Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost