31 lines
386 B
Go
31 lines
386 B
Go
package environment
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
type Env struct {
|
|
Path string
|
|
|
|
Env map[string]string
|
|
}
|
|
|
|
func Get_env() Env {
|
|
pwd, err := os.Getwd()
|
|
if err != nil {
|
|
log.Fatal(err.Error())
|
|
}
|
|
env := make(map[string]string)
|
|
for _, s_env := range os.Environ() {
|
|
split := strings.Split(s_env, "=")
|
|
env[split[0]] = split[1]
|
|
}
|
|
return Env{
|
|
Path: pwd,
|
|
Env: env,
|
|
}
|
|
|
|
}
|