diff --git a/examples/environment-variables/environment-variables.go b/examples/environment-variables/environment-variables.go index b316b8a..d1754a1 100644 --- a/examples/environment-variables/environment-variables.go +++ b/examples/environment-variables/environment-variables.go @@ -27,7 +27,7 @@ func main() { // get the key and value. Here we print all the keys. fmt.Println() for _, e := range os.Environ() { - pair := strings.Split(e, "=") + pair := strings.SplitN(e, "=", 2) fmt.Println(pair[0]) } } diff --git a/examples/environment-variables/environment-variables.hash b/examples/environment-variables/environment-variables.hash index b245851..e410038 100644 --- a/examples/environment-variables/environment-variables.hash +++ b/examples/environment-variables/environment-variables.hash @@ -1,2 +1,2 @@ -db2e203da519a22943753295e9cc27d89e4347b0 -bKuCOOD16KH +b651bc17e4d2880cba0885c52f476ab2a86e39ae +MTbfmZYa4vP diff --git a/public/environment-variables b/public/environment-variables index 25504ae..9920efd 100644 --- a/public/environment-variables +++ b/public/environment-variables @@ -44,7 +44,7 @@ Let’s look at how to set, get, and list environment variables.
package main
fmt.Println()
for _, e := range os.Environ() {
- pair := strings.Split(e, "=")
+ pair := strings.SplitN(e, "=", 2)
fmt.Println(pair[0])
}
}
@@ -186,7 +186,7 @@ program picks that value up.