Envparse is library for parse ENV variables written in Go.
Taken from moby/docker Dockerfile parser.
See original moby parser.
Parses env variables in form of:
<key> <value>
<key>=<value> ...
See also original ENV documentation
package main
import (
"bytes"
"fmt"
"github.com/go-x-pkg/envparse"
)
func main() {
env, err := envparse.Parse("LD_LIBRARY_PATH=/usr/lib:/usr/nvidia/cuda/lib64 PATH=/usr/bin:/bin")
fmt.Println(env, err)
}