26 lines
310 B
Go
26 lines
310 B
Go
package env
|
|
|
|
import (
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
type Env struct {
|
|
}
|
|
|
|
func (e *Env) GetAllEnv() map[string]string {
|
|
m := make(map[string]string, 0)
|
|
|
|
for _, e := range os.Environ() {
|
|
envs := strings.SplitN(e, "=", 2)
|
|
|
|
if len(envs) != 2 {
|
|
m[envs[0]] = ""
|
|
} else {
|
|
m[envs[0]] = envs[1]
|
|
}
|
|
}
|
|
|
|
return m
|
|
}
|