MCPcopy Index your code
hub / github.com/jetify-com/devbox / MapToPairs

Function MapToPairs

internal/envir/util.go:51–60  ·  view source on GitHub ↗

MapToPairs creates a slice of environment variable "key=value" pairs from a map.

(m map[string]string)

Source from the content-addressed store, hash-verified

49// MapToPairs creates a slice of environment variable "key=value" pairs from a
50// map.
51func MapToPairs(m map[string]string) []string {
52 pairs := make([]string, len(m))
53 i := 0
54 for k, v := range m {
55 pairs[i] = k + "=" + v
56 i++
57 }
58 slices.Sort(pairs) // for reproducibility
59 return pairs
60}
61
62// PairsToMap creates a map from a slice of "key=value" environment variable
63// pairs. Note that maps are not ordered, which can affect the final variable

Callers 2

EnvVarsMethod · 0.92
RunMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected